summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJesse Wolfe <jes5199@gmail.com>2010-12-28 17:18:55 -0800
committerJesse Wolfe <jes5199@gmail.com>2011-01-03 11:30:02 -0800
commit06a8d1ee8775ba8693ced002f5972bbfc346ebf8 (patch)
tree7c91aeb9a4055af0de5d6cd884de9540941e9927 /lib
parent4664460e0a4a935dab814a3218fc054c13e3cab6 (diff)
downloadpuppet-06a8d1ee8775ba8693ced002f5972bbfc346ebf8.tar.gz
puppet-06a8d1ee8775ba8693ced002f5972bbfc346ebf8.tar.xz
puppet-06a8d1ee8775ba8693ced002f5972bbfc346ebf8.zip
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 <nick@puppetlabs.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/application/inspect.rb8
-rw-r--r--lib/puppet/reports/http.rb2
2 files changed, 7 insertions, 3 deletions
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
diff --git a/lib/puppet/reports/http.rb b/lib/puppet/reports/http.rb
index 7ac54dfbd..101c8e0cb 100644
--- a/lib/puppet/reports/http.rb
+++ b/lib/puppet/reports/http.rb
@@ -15,7 +15,7 @@ Puppet::Reports.register_report(:http) do
req = Net::HTTP::Post.new(url.path)
req.body = self.to_yaml
req.content_type = "application/x-yaml"
- Net::HTTP.new(url.host, url.port).start {|http|
+ p Net::HTTP.new(url.host, url.port).start {|http|
http.request(req)
}
end