Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 0.8.16
-
Fix Version/s: 0.10.4
-
Component/s: Chef Client
-
Labels:None
-
Environment:
ubuntu 9.10
Description
given a couple resources like this:
mount node[:nfs][:data_mount_point] do
device "#{node[:nfs][:data_device]}"
fstype "ext3"
action :nothing
only_if "/usr/bin/test -b #{node[:nfs][:data_device]}"
end
directory node[:nfs][:data_mount_point] do
path node[:nfs][:data_mount_point]
notifies :enable, resources(:mount => node[:nfs][:data_mount_point]), :immediately
notifies :mount, resources(:mount => node[:nfs][:data_mount_point]), :immediately
end
an error like this occurs:
[Wed, 11 Aug 2010 19:52:30 +0000] DEBUG: Processing mount[/srv/nfs]
[Wed, 11 Aug 2010 19:52:30 +0000] DEBUG: Executing /usr/bin/test -b /dev/sdh
[Wed, 11 Aug 2010 19:52:30 +0000] DEBUG: ---- Begin output of /usr/bin/test -b /dev/sdh ----
[Wed, 11 Aug 2010 19:52:30 +0000] DEBUG: STDOUT:
[Wed, 11 Aug 2010 19:52:30 +0000] DEBUG: STDERR:
[Wed, 11 Aug 2010 19:52:30 +0000] DEBUG: ---- End output of /usr/bin/test -b /dev/sdh ----
[Wed, 11 Aug 2010 19:52:30 +0000] DEBUG: Ran /usr/bin/test -b /dev/sdh returned 0
[Wed, 11 Aug 2010 19:52:30 +0000] DEBUG: mount[/srv/nfs] using Chef::Provider::Mount::Mount
[Wed, 11 Aug 2010 19:52:30 +0000] DEBUG: Checking for mount point /srv/nfs
[Wed, 11 Aug 2010 19:52:30 +0000] ERROR: mount[/srv/nfs] (/var/cache/chef/cookbooks/nfs/recipes/server.rb line 9) had an error:
Mount point /srv/nfs does not exist
notice that the mount resource is running the only_if logic and "Checking for mount point /srv/nfs," despite the fact that its action is set to :nothing. the behavior i expected was for that mount resource to truly do nothing until the directory was created by the next resource.
my current workaround is to add an additional check for the mountpoint using only_if:
only_if "/usr/bin/test -b #{node[:nfs][:data_device]} && /usr/bin/test -d #{node[:nfs][:data_mount_point]}"
What you're encountering is not a bug.
notifies :immediate will do just that - notify immediately, sometimes even before the action has been carried out. If you want something to happen after - please use :delayed notify.