class ChefCLI::PolicyfileServices::UpdateAttributes
def run
def run assert_policy_and_lock_present! prepare_constraints if policyfile_compiler.default_attributes != policyfile_lock.default_attributes policyfile_lock.default_attributes = policyfile_compiler.default_attributes @updated = true end if policyfile_compiler.override_attributes != policyfile_lock.override_attributes policyfile_lock.override_attributes = policyfile_compiler.override_attributes @updated = true end if updated_lock? with_file(policyfile_lock_expanded_path) do |f| f.print(FFI_Yajl::Encoder.encode(policyfile_lock.to_lock, pretty: true )) end ui.msg("Updated attributes in #{policyfile_lock_expanded_path}") else ui.msg("Attributes already up to date") end rescue => error raise PolicyfileUpdateError.new("Failed to update Policyfile lock", error) end