Ohai!I love seeing the diffs during chef-client/chef-solo runs. It is such a huge aid in debugging.That being said, there are certain resources, i.e. key files, where I don’t want this enabled.I’m currently dealing with this like:saved = Chef::Config[:diff_filesize_threshold]Chef::Config[:diff_filesize_threshold] = 0f = Chef::File::Resource.new(path, run_context)f.action :nothingf.content from_encrypted_databagf.run_action(:create)Chef::Config[:diff_filesize_threshold] = savedIt is really ugly, but it gets the job done. Taking inspiration from nod from chef-sugar, I could do something like:def quietly(&block)saved = Chef::Config[:diff_filesize_threshold]Chef::Config[:diff_filesize_threshold] = 0begininstance_eval(&block)rescue Exception => exChef::Config[:diff_filesize_threshold] = savedraise exendChef::Config[:diff_filesize_threshold] = savedendAnd then do:quietly dof = Chef::File::Resource.new(filename, run_context)f.action :nothingf.content from_encrypted_databagf.run_action(:create)endIs there a better way of doing this? Maybe:file filename doaction :createcontent from_encrypted_databagwith {:diff_filesize_threshold => 0 }endThanks.Joe
Archive powered by MHonArc 2.6.16.