From 06a8d1ee8775ba8693ced002f5972bbfc346ebf8 Mon Sep 17 00:00:00 2001 From: Jesse Wolfe Date: Tue, 28 Dec 2010 17:18:55 -0800 Subject: Fix #5698 puppet inspect shouldn't report of attributes of deleted files If a resource is absent, then reporting that its properties are all ":absent" is not particularly correct. This patch makes the `inspect` application's reports behave more like `apply` reports, and skip properties other than :ensure for absent resources. Reviewed-By: Nick Lewis --- lib/puppet/application/inspect.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib/puppet/application') diff --git a/lib/puppet/application/inspect.rb b/lib/puppet/application/inspect.rb index caa32a7c2..342b8daae 100644 --- a/lib/puppet/application/inspect.rb +++ b/lib/puppet/application/inspect.rb @@ -64,8 +64,12 @@ class Puppet::Application::Inspect < Puppet::Application status = Puppet::Resource::Status.new(ral_resource) audited_attributes.each do |name| - event = ral_resource.event(:previous_value => audited_resource[name], :property => name, :status => "audit", :message => "inspected value is #{audited_resource[name].inspect}") - status.add_event(event) + next if audited_resource[name].nil? + # Skip :absent properties of :absent resources. Really, it would be nicer if the RAL returned nil for those, but it doesn't. ~JW + if name == :ensure or audited_resource[:ensure] != :absent or audited_resource[name] != :absent + event = ral_resource.event(:previous_value => audited_resource[name], :property => name, :status => "audit", :message => "inspected value is #{audited_resource[name].inspect}") + status.add_event(event) + end end @report.add_resource_status(status) end -- cgit