Ask Your Question

ENV variables for .fixtures.yaml

asked 2016-06-17 08:11:51 -0600

DarylW gravatar image

updated 2016-09-14 11:35:44 -0600

Is it possible to use an ENV variable to define repositories in the .fixtures.yaml file for puppetlabs_spec_helper ? We have an environment where modules are shared/mirrored across different git repositories that exist on different servers in different networks, and we can't give them the same DNS name everywhere.

Is it possible to reference an ENV variable to use for the base git repository in a .fixtures.yaml file? If not, is my only option that we keep a constant 'patch' set that we rebase ontop of the copy/clone that modifies the .fixtures.yaml file? could I / should I 'generate' the .fixtures.yaml file as a task that must happen before any of the built in tasks that require the file to exist?


As an update, it looks like the 'value' of the .fixtures.yaml symlink is done in an eval, so I was able to do something like the following..

    stdlib: "#{ENV['VENDOR_LIB'] or './vendor'}/puppetlabs-stdlib-4.8.0"

This allows me to add my own task to populate a vendorlib directory for our vendored .tar.gz files for foss modules. I haven't looked to see if an eval is used for the repository portion or not.

edit retag flag offensive close merge delete


Nice one!

Alex Harvey gravatar imageAlex Harvey ( 2016-09-15 03:06:27 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2016-06-17 08:32:15 -0600

updated 2016-06-17 08:38:18 -0600

The relevant code is here, so no. However, you can always modify the behaviour by defining your own methods in your Rakefile. You can make it do whatever you like that way.

edit flag offensive delete link more


I did find a clone of garethr's skeleton with a .fixtures.local.yaml.erb, but I don't know if that is only for module generation time. How would I have two files, and pick between them with a custom Rakefile?

DarylW gravatar imageDarylW ( 2016-06-17 09:48:32 -0600 )edit

Yes, should be for module generation. You can redefine any Rake task in your Rake file using the clear method. Then rewrite it in Ruby to have it do whatever you want it to do.

Alex Harvey gravatar imageAlex Harvey ( 2016-06-17 10:18:24 -0600 )edit

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: 2016-06-17 08:11:51 -0600

Seen: 350 times

Last updated: Sep 14 '16