- From: Matt Horan <matt@matthoran.com>
- To: chef@lists.opscode.com
- Subject: [chef] Execute on notification documentation typo
- Date: Wed, 15 Jul 2009 16:44:41 -0400
According to
http://wiki.opscode.com/display/chef/Resources#Resources-Execute, the
following should cause the execute statement to be called after creation
of the template:
execute "configure_open-iscsi" do
command "/tmp/configure_open-iscsi.pl"
user "root"
action :nothing
end
template "/tmp/configure_open-iscsi.pl" do
source "configure_open-iscsi.pl.erb"
owner "root"
group "root"
mode 0700
notifies :create, resources(:execute => "configure_open-iscsi")
end
Note that the notifies line is incorrect. The template must notify the
execute statement to run, not create. Otherwise, the following error
occurs:
INFO: template[/tmp/configure_open-iscsi.pl] sending create action to
execute[configure_open-iscsi] (delayed)
/usr/lib/ruby/gems/1.8/gems/chef-0.7.4/lib/chef/runner.rb:118:in `send':
undefined method `action_create' for
#<Chef::Provider::Execute:0x2b466c437938> (NoMethodError)
The following runs as expected:
template "/tmp/configure_open-iscsi.pl" do
source "configure_open-iscsi.pl.erb"
owner "root"
group "root"
mode 0700
notifies :run, resources(:execute => "configure_open-iscsi")
end
--
Matt Horan matt@matthoran.com
http://matthoran.com/
- [chef] Execute on notification documentation typo, Matt Horan, 07/15/2009
Archive powered by MHonArc 2.6.16.