[chef] Problem with notifies


Chronological Thread 
  • From: Zuhaib Siddique < >
  • To: " " < >
  • Subject: [chef] Problem with notifies
  • Date: Fri, 25 May 2012 13:32:52 -0700

Hi,

I am running in to an odd problem with notification in Chef 10.10, it seems suddenly this block of code is not working as expected:

execute "set-hostname" do
  command "hostname --file /etc/hostname"
  action :nothing
end

file "/etc/hostname" do
  content "#{new_hostname}"
  notifies :run, "execute[set-hostname]", :immediately
end

In the chef log I get this:

.compute-1.amazonaws.com [Fri, 25 May 2012 20:13:57 +0000] INFO: Processing execute[set-hostname] action nothing (gridiron-deploy::default line 44)
.compute-1.amazonaws.com [Fri, 25 May 2012 20:13:57 +0000] INFO: Processing file[/etc/hostname] action create (gridiron-deploy::default line 49)
.compute-1.amazonaws.com [Fri, 25 May 2012 20:13:57 +0000] INFO: file[/etc/hostname] backed up to /var/chef/backup/etc/hostname.chef-20120525201357
.compute-1.amazonaws.com [Fri, 25 May 2012 20:13:57 +0000] INFO: file[/etc/hostname] contents updated


But when I login to the box the hostname is not set.  Inspecting /etc/hostname show its populated with the correct info and running hostname --file /etc/hostname on the box works but it seems via Chef its no go.  On a local box using shef it works fine.  Beside me getting hack-y and making it a bash command any ideas?

Zuhaib



Archive powered by MHonArc 2.6.16.

§