Comments (3)
@jruybal
Short answer: Don't dynamically generate your Puppetfile through Vagrant. If you need to dynamically generate it, trigger that script manually and then commit the result to the git repo.
Long answer:
Unfortunately, I don't think there is. My memory on this next point is a bit hazy, so some of this might not be 100% correct. Also, it's honestly possible that there is a better way to do this, that I missed. But there's really precious little documentation about how Vagrant plugins work or how to write them...
The way this works is a bit complicated, but the gist is that Vagrant has two "phases" of running plugins and provisioners; (config) validation and provisioning. There doesn't seem to be any way to force the order that plugins run in, so my only choice was to have vagrant-r10k do its actual deploy in the validation phase. As a result, vagrant-r10k will run before any provisioner.
If this bootstrapping script generates the Puppetfile, and presumably runs on your host (not in the Vagrant guest), is there a reason why it needs to be a provisioning script?
This may or may not be workable for you: maybe just don't use it as a provisioning script, but rather execute it at the top of your Vagrantfile, before the Vagrant.configure
block; IIRC that should run before Vagrant does anything, though it will also run for any vagrant
command.
Another option would be to turn this into a feature request, and add a configuration option to vagrant-r10k for a block of code to run at the very beginning of the r10k stuff. I'm not sure how quickly I could get that done, and how much I like the idea...
However, I'm not sure what your exact use case is, but I'm very hesitant to do a whole lot to enable dynamic generation of Puppetfiles, which is very likely to cause problems. Puppetfiles are like any other language's dependency specified (requirements.txt in python, Gemfile in ruby, pom.xml for java/maven) and will almost certainly break things eventually if they're generated dynamically rather than being manually reviewed and committed with the code.
from vagrant-r10k.
Thanks for the detailed explanation. This makes a lot more sense now.
Our dynamic generation of the puppetfile is nothing more than looking at the module's metadata.json files for dependencies and adding the name and version number into the puppetfile. This only used in our development environment. These puppetfiles and their managed modules are kept out of the repo in an effort to keep the repo from exploding.
from vagrant-r10k.
Ok, that makes sense. For the record, if it were me, I'd do one of these things, depending on which is easiest to implement in your environment:
- Have the Puppetfile generation script run manually when metadata.json is changed.
- That, but have a test or git update hook that rejects the commit if metadata.json changes and the Puppetfile doesn't.
- Do the generation in your CI system; when a commit changes metadata.json, have it run the Puppetfile generation script and commit the result back to the repo.
- Push for me to give vagrant-r10k the ability to execute an aribtrary block of Ruby code before it runs r10k.
from vagrant-r10k.
Related Issues (20)
- Integration/functional tests HOT 6
- upgrade r10k HOT 5
- validate Puppetfile in config validate HOT 2
- Can't power up a VM if Internet connection is down HOT 4
- docs - vagrant plugin install puppet
- No validation of nil module_path HOT 5
- No validation of nil module_path HOT 1
- vmware_workstation acceptance tests
- code analysis HOT 6
- Test ticket from Code Climate
- [R10K::TaskRunner - ERROR] on OSX (yosemite) host HOT 10
- Ability to run arbitrary ruby code block before r10k
- Error occurred: no implicit conversion of nil into String HOT 7
- Support puppet_server provisioner HOT 3
- r10k deploy error on Windows HOT 2
- undefined method `activate_bin_path' HOT 5
- undefined method `original' HOT 1
- `find_spec_for_exe': can't find gem puppet (>= 0.a) (Gem::GemNotFoundException) HOT 4
- problem library ruby 3 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vagrant-r10k.