Comments (8)
What we do is have /etc/chef/client.rb be a symlink. It either points to client-prod.rb or client-test.rb, and we have chef write out client-prod.rb instead of client.rb. Our setup is slightly more complicated, but that's the basic idea.
from chef-zero.
@jaymzh That's one way to go. But ideally I don't want to know the url beforehand (it is handled by a Chef recipe, based on the environment the Chef run is running in).
from chef-zero.
For the main client.rb? Sure... have Chef write that out that template as /etc/chef/client-prod.rb instead of /etc/chef/client.rb - the fact that Chef writes out that file doesn't have to change. Or am I misunderstanding?
from chef-zero.
@jaymzh I see what you are getting at, but in my original post I mention the use of the chef-client
cookbook. Looking at the way the config-reload is handled, I don't see any way (besides using something like chef-rewind
to override the loading of the written config file.
The cookbook writes a client.rb
and the loads the configs from that file. There is no way to change this right now.
from chef-zero.
If client.rb doens't suit your environment change it...
vi cookbooks/chef-client/recipes/client.rb
and change line 73 to:
template "#{node["chef_client"]["conf_dir"]}/client-prod.rb" do
Then add:
link "#{node["chef_client"]["conf_dir"]}/client.rb" do
# let our test processes point this elsewhere for chef-zero testing
not_if { File.exists?("#{node["chef_client"]["conf_dir"]}/client.rb") }
to "#{node["chef_client"]["conf_dir"]}/client-prod.rb"
end
from chef-zero.
Well, of course I can modify the community cookbook, but that's really an anti-pattern. That's why I also mentioned chef-rewind
, but I'd rather do this the "proper way", instead of monkey patching a community cookbook using chef-rewind
, or worse, forking the community cookbook for personal use.
I did just commit a pull request to add the option not to reload the config. That will solve my issues.
from chef-zero.
That approach means you only get one test-run against your chefzero server. The indirection means that you can do as many test runs as you need until you're ready to revert it.
Modifying cookbooks shouldn't be an anti-pattern... git handles merges very well. :)
from chef-zero.
Git does. But I just prefer the wrapper-cookbook approach to be on the safe side. And if possible (and it makes sense for others), I'd rather merge changes upstream.
You are right that this approach only gives a single test-run against ChefZero. But I also want this change for other changes unrelated to ChefZero (f.e. one-time changes to be used during a Packer.io machine building process).
Thank you for your valuable input though. It helped me solve the problem eventually.
from chef-zero.
Related Issues (20)
- kitchen and chef-zero 404ing on data bag HOT 3
- check if a data_bag exists HOT 1
- chef-zero should make data available on save HOT 4
- Exception when file has #2 at the end of name HOT 1
- Chef zero outputs too much information for info log level HOT 3
- Chef encountered an error attempting to load the node data HOT 2
- Should do a release HOT 7
- Uploading cookbooks to chef-zero using berks often crashes when Request timeout is 300 HOT 3
- Improper require of Hashie causing error (NameError: uninitialized constant Hashie::Extensions::Array) HOT 5
- Unable to connect to chef-zero HOT 1
- Chef 13 vs Chef 12 ip address resolution HOT 1
- Completely arbitrary ruby version requirement HOT 2
- Need a mode of operation where chef-zero runs in-memory but populates from the disk cache
- Do not format the node definition JSON file after converging HOT 1
- Could chef-zero please support fetching inspec profiles?
- Re-raising exception: URI::InvalidURIError - bad URI(is not URI?)
- missing webrick makes chef-zero fail
- Add unique email contraint while creating user
- Configuring the chef-zero-automate reporter for the compliance phase 404s in TK against chef-zero
- Policy Groups in the policy file details (chef-zero) HOT 2
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 chef-zero.