- From: John Alberts <
>
- To:
- Subject: [chef] strange node attribute problem
- Date: Thu, 23 May 2013 00:02:26 -0500
I have a strange problem with using a node attribute that recently had the value changed.
I have a ruby_block resource that sets a node attribute. The following mount resource uses that node attribute, but it is getting the old value of that node attribute, not the new value that was just set by the previous ruby_block. I've tried adding a node.save in that ruby_block, but the mount resource still gets the old attribute value. Of course, since I did a node.save, the mount resource gets the new value because it was save on the previous failed chef run.
Is this expected behavior? I've never noticed this before.
Here is the section of code I'm having the issue with. It's the node[:ebs][:devicetomount] attribute that I'm having trouble with.
Thanks
John
ruby_block "Create or attach LVM volume out of #{raid_device}" do
block do
BlockDevice.create_lvm(raid_device, options)
node.set[:ebs][:devicetomount] = node[:ebs][:lvm_device]
node.save unless Chef::Config[:solo]
end
only_if { options[:uselvm] }
action :create
end
mount options[:mount_point] do
fstype options[:fstype]
device node[:ebs][:devicetomount]
options "noatime"
not_if do
File.read('/etc/mtab').split("\n").any?{|line| line.match(" #{options[:mount_point]} ")}
end
end
- [chef] strange node attribute problem, John Alberts, 05/22/2013
Archive powered by MHonArc 2.6.16.