Information Technology Reference
In-Depth Information
If you try to deploy this new cookbook to the production node, you should get an error say-
ing
could not satisfy version constraints
. Now we know that our production environment is
enforcing the policy we set to pin the
apache
cookbook to version
0.1.0
. When we tried to
deploy version
0.2.0
, we got an error:
$
kitchen converge prod-centos65
...
Missing Cookbooks:
------------------
Could not satisfy version constraints for: apache
...
Chef Client failed. 0 resources updated in 1.626076356 seconds
[2014-08-22T17:59:26-07:00] ERROR: 412 "Precondition Failed "
[2014-08-22T17:59:26-07:00] FATAL: Chef::Exceptions::ChildConvergeError:
Chef run process exited unsuccessfully (exit code 1)
>>>>>> Converge failed on instance <prod-centos65>.
>>>>>> Please see .kitchen/logs/prod-centos65.log for more
details
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: SSH exited (1) for command: [sudo -E
chef-client -z --config /tmp/kitchen/client.rb --log_level info
--chef-zero-port 8889 --json-attributes /tmp/kitchen/dna.json]
>>>>>> ----------------------
Add a new environment definition to
chef-zero/environments
as shown in
set the
node['apache']['port']
and
node['motd']['message']
to use developer-specif-
ic overrides.
Example 15-12. chefdk/chef-zero/environments/dev.json
{
"name"
:
"dev"
,
"description"
:
"For developers!"
,
"cookbook_versions"
: {
"apache"
:
"= 0.2.0"
},
"json_class"
:
"Chef::Environment"
,
"chef_type"
:
"environment"
,
"override_attributes"
: {
"apache"
: {
"port"
:
8080