Version locking a cookbook in environment AND role

Hi folks,

I’m having trouble version locking a cookbook in the environment AND
role at the same time.

In my environment file I have:

cookbook “java”, “= 0.0.10”

In my role I have:

run_list(

“recipe[java@0.0.11]”,

)

However, when I run chef-client, I get Net::HTTPServerException: 412
"Precondition Failed":

Generated at Thu Sep 27 12:17:15 -0700 2012
Net::HTTPServerException: 412 “Precondition Failed”
/usr/lib64/ruby/1.8/net/http.rb:2105:in error!' /usr/lib64/ruby/gems/1.8/gems/chef-10.12.0/bin/../lib/chef/rest.rb:266:inapi_request’
/usr/lib64/ruby/gems/1.8/gems/chef-10.12.0/bin/…/lib/chef/rest.rb:334:in
retriable_rest_request' /usr/lib64/ruby/gems/1.8/gems/chef-10.12.0/bin/../lib/chef/rest.rb:242:inapi_request’
/usr/lib64/ruby/gems/1.8/gems/chef-10.12.0/bin/…/lib/chef/rest.rb:141:in
post_rest' /usr/lib64/ruby/gems/1.8/gems/chef-10.12.0/bin/../lib/chef/client.rb:313:insync_cookbooks’
/usr/lib64/ruby/gems/1.8/gems/chef-10.12.0/bin/…/lib/chef/client.rb:194:in
setup_run_context' /usr/lib64/ruby/gems/1.8/gems/chef-10.12.0/bin/../lib/chef/client.rb:162:inrun’
/usr/lib64/ruby/gems/1.8/gems/chef-10.12.0/bin/…/lib/chef/application/client.rb:254:in
run_application' /usr/lib64/ruby/gems/1.8/gems/chef-10.12.0/bin/../lib/chef/application/client.rb:241:inloop’
/usr/lib64/ruby/gems/1.8/gems/chef-10.12.0/bin/…/lib/chef/application/client.rb:241:in
run_application' /usr/lib64/ruby/gems/1.8/gems/chef-10.12.0/bin/../lib/chef/application.rb:70:inrun’
/usr/lib64/ruby/gems/1.8/gems/chef-10.12.0/bin/chef-client:26
/usr/bin/chef-client:19:in `load’
/usr/bin/chef-client:19

Running “knife cookbook show” returns expected results:

$ knife cookbook show java
java 0.0.11 0.0.10 0.0.9 0.0.8 0.0.7

Any suggestions as to why it fails?


Best regards, Dmitriy V.

Hi,

On Fri, Sep 28, 2012 at 5:26 AM, DV vindimy@gmail.com wrote:

I'm having trouble version locking a cookbook in the environment AND
role at the same time.

In my environment file I have:

cookbook "java", "= 0.0.10"

In my role I have:

run_list(
...
"recipe[java@0.0.11]",
...
)

It looks like you are attempting to lock them to different versions so I am
not surprised that this does not work. It can not satisfy both constraints.
(But note I have not tried it out). What version of the java cookbook do
you expect a node in that environment with that role to use?

--
Cheers,

Peter Donald

I am hoping to have entire environment locked down to cookbook version
0.0.10, while the nodes with that role assigned locked down to 0.0.11.
If both environment and role are setting the same "lockdown" attribute
and role takes precedence, I would expect it to work that way.
However, if what chef-client is getting is something along the lines
of "java cookbook that's 0.0.10 and 0.0.11" then I see why it's not
working as I intend it to.

  • DV

On Thu, Sep 27, 2012 at 12:54 PM, Peter Donald peter@realityforge.org wrote:

Hi,

On Fri, Sep 28, 2012 at 5:26 AM, DV vindimy@gmail.com wrote:

I'm having trouble version locking a cookbook in the environment AND
role at the same time.

In my environment file I have:

cookbook "java", "= 0.0.10"

In my role I have:

run_list(
...
"recipe[java@0.0.11]",
...
)

It looks like you are attempting to lock them to different versions so I am
not surprised that this does not work. It can not satisfy both constraints.
(But note I have not tried it out). What version of the java cookbook do you
expect a node in that environment with that role to use?

--
Cheers,

Peter Donald

--
Best regards, Dmitriy V.