Execute on notification documentation typo


#1

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 methodaction_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/


#2

Hi,

On 16/07/2009, at 8:44 AM, Matt Horan wrote:

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:
[snip]

Thanks for this, I have edited the page. As it is a wiki, feel free to
register an account and make trivial typo edits yourself :slight_smile:


AJ Christensen, Software Engineer
Opscode, Inc.
E: aj@opscode.com