Skip to content

Instantly share code, notes, and snippets.

@ohookins
Created October 18, 2012 08:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ohookins/3910413 to your computer and use it in GitHub Desktop.
Save ohookins/3910413 to your computer and use it in GitHub Desktop.
Chef seems to lack unique resource naming...
root@squeeze:/var/chef/cookbooks/test/recipes# cat foo.rb
execute "load" do
command "/bin/echo 'load called from test::foo'"
action :nothing
end
file "/tmp/foo" do
action :touch
notifies :run, "execute[load]", :immediately
end
root@squeeze:/var/chef/cookbooks/test/recipes# cat bar.rb
execute "load" do
command "/bin/echo 'load called from test::bar'"
action :nothing
end
file "/tmp/bar" do
action :touch
notifies :run, "execute[load]", :immediately
end
root@squeeze:/var/chef/cookbooks/test/recipes# chef-solo -o test::foo,test::bar
[2012-10-18T08:14:33+00:00] WARN: *****************************************
[2012-10-18T08:14:33+00:00] WARN: Did not find config file: /etc/chef/solo.rb, using command line options.
[2012-10-18T08:14:33+00:00] WARN: *****************************************
[2012-10-18T08:14:33+00:00] INFO: *** Chef 10.14.2 ***
[2012-10-18T08:14:33+00:00] WARN: Run List override has been provided.
[2012-10-18T08:14:33+00:00] WARN: Original Run List: []
[2012-10-18T08:14:33+00:00] WARN: Overridden Run List: [recipe[test::foo], recipe[test::bar]]
[2012-10-18T08:14:33+00:00] INFO: Run List is [recipe[test::foo], recipe[test::bar]]
[2012-10-18T08:14:33+00:00] INFO: Run List expands to [test::foo, test::bar]
[2012-10-18T08:14:33+00:00] INFO: Starting Chef Run for squeeze.vagrantup.com
[2012-10-18T08:14:33+00:00] INFO: Running start handlers
[2012-10-18T08:14:33+00:00] INFO: Start handlers complete.
[2012-10-18T08:14:33+00:00] INFO: Processing execute[load] action nothing (test::foo line 1)
[2012-10-18T08:14:33+00:00] INFO: Processing file[/tmp/foo] action touch (test::foo line 6)
[2012-10-18T08:14:33+00:00] INFO: file[/tmp/foo] updated atime and mtime to Thu Oct 18 08:14:33 +0000 2012
[2012-10-18T08:14:33+00:00] INFO: file[/tmp/foo] sending run action to execute[load] (immediate)
[2012-10-18T08:14:33+00:00] INFO: Processing execute[load] action run (test::bar line 1)
load called from test::bar
[2012-10-18T08:14:34+00:00] INFO: execute[load] ran successfully
[2012-10-18T08:14:34+00:00] INFO: Processing execute[load] action nothing (test::bar line 1)
[2012-10-18T08:14:34+00:00] INFO: Processing file[/tmp/bar] action touch (test::bar line 6)
[2012-10-18T08:14:34+00:00] INFO: file[/tmp/bar] updated atime and mtime to Thu Oct 18 08:14:34 +0000 2012
[2012-10-18T08:14:34+00:00] INFO: file[/tmp/bar] sending run action to execute[load] (immediate)
[2012-10-18T08:14:34+00:00] INFO: Processing execute[load] action run (test::bar line 1)
load called from test::bar
[2012-10-18T08:14:34+00:00] INFO: execute[load] ran successfully
[2012-10-18T08:14:34+00:00] INFO: Chef Run complete in 0.0404030000000001 seconds
[2012-10-18T08:14:34+00:00] INFO: Running report handlers
[2012-10-18T08:14:34+00:00] INFO: Report handlers complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment