summaryrefslogtreecommitdiffstats
path: root/lib/puppet/application/inspect.rb
diff options
context:
space:
mode:
authorNick Lewis <nick@puppetlabs.com>2011-01-13 16:59:29 -0800
committerNick Lewis <nick@puppetlabs.com>2011-01-13 16:59:29 -0800
commit0b19744c5e01dacaff34e3348b77bcd6297f492e (patch)
tree89d8f2750f54a1d589aa5cf902b08c7487bfc3b2 /lib/puppet/application/inspect.rb
parent8c60cebababafbacf031a4ad842a615e82910cf0 (diff)
parent79b633220376bf0503f926b9371283cece17a9e6 (diff)
downloadpuppet-0b19744c5e01dacaff34e3348b77bcd6297f492e.tar.gz
puppet-0b19744c5e01dacaff34e3348b77bcd6297f492e.tar.xz
puppet-0b19744c5e01dacaff34e3348b77bcd6297f492e.zip
Merge branch 'ticket/2.6.next/5882' into 2.6.next
Diffstat (limited to 'lib/puppet/application/inspect.rb')
-rw-r--r--lib/puppet/application/inspect.rb45
1 files changed, 32 insertions, 13 deletions
diff --git a/lib/puppet/application/inspect.rb b/lib/puppet/application/inspect.rb
index b4d263545..77e8476a2 100644
--- a/lib/puppet/application/inspect.rb
+++ b/lib/puppet/application/inspect.rb
@@ -64,30 +64,49 @@ class Puppet::Application::Inspect < Puppet::Application
audited_attributes = ral_resource[:audit]
next unless audited_attributes
- audited_resource = ral_resource.to_resource
-
status = Puppet::Resource::Status.new(ral_resource)
- audited_attributes.each do |name|
- 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
+
+ begin
+ audited_resource = ral_resource.to_resource
+ rescue StandardError => detail
+ puts detail.backtrace if Puppet[:trace]
+ ral_resource.err "Could not inspect #{ral_resource}; skipping: #{detail}"
+ audited_attributes.each do |name|
event = ral_resource.event(
- :previous_value => audited_resource[name],
- :property => name,
- :status => "audit",
- :audited => true,
- :message => "inspected value is #{audited_resource[name].inspect}"
+ :property => name,
+ :status => "failure",
+ :audited => true,
+ :message => "failed to inspect #{name}"
)
status.add_event(event)
end
+ else
+ audited_attributes.each do |name|
+ 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",
+ :audited => true,
+ :message => "inspected value is #{audited_resource[name].inspect}"
+ )
+ status.add_event(event)
+ end
+ end
end
- @report.add_resource_status(status)
if Puppet[:archive_files] and ral_resource.type == :file and audited_attributes.include?(:content)
path = ral_resource[:path]
if File.readable?(path)
- dipper.backup(path)
+ begin
+ dipper.backup(path)
+ rescue StandardError => detail
+ Puppet.warning detail
+ end
end
end
+ @report.add_resource_status(status)
end
finishtime = Time.now