Is it possible to get a checksum of a cookbook file and store this in the attribute?require 'Digest'cb_filename = ? if node.attribute['staged_checksum'] == Digest::SHA2.file(File.new(cb_filename)) Chef::Log.info("Already been staged") else Chef::Log.info("Update staging")
node.attribute['staged_checksum'] = Digest::SHA2.file(File.new(cb_filename))end
On 15 Aug 2013, at 11:40, Ranjib Dey < " target="_blank"> > wrote:inside a recipeif node.attribute?('bar')Chef::Log.info('already run')elseruby_block 'set_attribute' doblock donod.set['foo']='bar'endendfile '/foo/bar' doend
content "foobar"
end
On Thu, Aug 15, 2013 at 3:20 AM, < " target="_blank"> > wrote:Hello,
Would would be the best way to only place a file once per cookbook version. It's modified and removed outside chef.
Regards
D.
Archive powered by MHonArc 2.6.16.