Ask Your Question

.fixture.yml only work in git repository

asked 2015-08-27 07:49:01 -0600

Chutki gravatar image


I have below manifests that module is dependent on others please find the example below.

 class test {

  include mod_test::example
include test

below is my spec file

require 'spec_helper'

describe 'test', :type => 'class' do

it { should contain_class('mod_test::example') }

I am getting below error due to dependency module "mod_test::example"

   Puppet::Parser::AST::Resource failed with error ArgumentError: Invalid resource type mod_test::example at /etc/puppet/modules/test/spec/fixtures/modules/env/manifests/filetype.pp:7 on node

I know the above error is due to couldn't find "mod_test::example" module.

The "modtest::example" module present under same directory "/etc/puppet/module/modtest", so I created the below link under /spec/fixtures/modules/test"

    |   |-- manifests
    |   |   `-- site.pp
    |   `-- modules
    |       `-- initd
    |           |-- manifests -> ../../../../manifests
    |           `-- mod_test -> /etc/puppet/modules/mod_test

below is fixtures.yml

    mod_test: "/etc/puppet/modules/mod_test" 
    test: "#{source_dir}"

when I run "rake spec" getting below error

Initialized empty Git repository in /etc/puppet/modules/test/spec/fixtures/modules/mod_test/.git/
fatal: failed to open '/etc/puppet/modules/mod_test/objects': No such file or directory
rake aborted!
Failed to clone git repository /etc/puppet/modules/mod_test into spec/fixtures/modules/mod_test

Tasks: TOP => spec_prep
(See full trace by running task with --trace)

1) Should I create git repository and load the "mod_test" module, then point the local repository details to .fixture.yml.

2) If so why do I need to create git repository when I have dependency module in my working directory.

3) Does .fixtures.yml only support if the dependency module is in git repo.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-08-27 17:53:36 -0600

lavaman gravatar image

updated 2015-08-27 17:54:50 -0600

You can create a git repo if you wish, but you don't have to. Because the module exists on the system, you want to make a symlink to it instead of a repository reference. Move the mod_test reference under symlinks and it should work.

The fixtures file repositories section only supports git repos because they are repositories. You can also install module from the forge if you add a forge_modules section to the fixtures file. See the documentation here.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2015-08-27 07:49:01 -0600

Seen: 1,183 times

Last updated: Aug 27 '15