Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Unknown
-
Resolution: Duplicate
-
Affects Version/s: 0.10.8
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
Description
I've the following test setup (please ignore the actual work the recipes doing):
A definition under 'test' recipe:
define :test_app, :name => "test" do name = params[:name] log "Does /root/#{name}/test exist? #{File.exist?("/root/#{name}/test")}" bash "do_something" do user "root" group "root" not_if { File.exist?("/root/#{name}/test") } code <<-EOH mkdir -p /root/#{name}/test EOH end end
Two cookbooks that uses above definition:
test_cookbook_1::default:
include_recipe 'test'
test_app "test_cookbook_1"
test_cookbook_2::default:
include_recipe 'test'
test_app "test_cookbook_2"
And finally a role that uses both cookbooks:
test_role:
run_list( "recipe[test_cookbook_1::default]", "recipe[test_cookbook_2::default]" )
When I assign 'test_role' to a node, and run chef-client, 'do_something' resource works properly for 'test_cookbook_1' as expected. However, for 'test_cookbook_2' it's being skipped due to not_if statement, which shouldn't be the case.
[Thu, 26 Jan 2012 18:00:43 +0000] INFO: Does /root/test_cookbook_2/test exist? false
[Thu, 26 Jan 2012 18:00:43 +0000] DEBUG: Processing bash[do_something] on XXX
[Thu, 26 Jan 2012 18:00:43 +0000] DEBUG: Skipping bash[do_something] due to not_if ruby block
This exact setup was running fine on Chef 9, and started to fail when we upgraded to Chef 10.
When I rename 'do_something' as follows, everything runs as exected:
...
bash "do_something_for_#{name}" do
user "root"
...
It looks like Chef10 is keeping state of resources based on the resource name only, which is odd. Any ideas?
Issue Links
- duplicates
-
CHEF-2812
0.10.4 -> 0.10.6 regression when reloading prior state from resources
-
This is actually expected behavior that started occurring more strictly after 0.10.8. I will discuss this further on
CHEF-2812, let's focus the discussion there.