Paired-with: Jesse Wolfe

Signed-off-by: Matt Robinson <[email protected]>
---
 lib/puppet/application/inspect.rb     |    8 +++++++-
 spec/unit/application/inspect_spec.rb |   20 ++++++++++++++++++++
 2 files changed, 27 insertions(+), 1 deletions(-)

diff --git a/lib/puppet/application/inspect.rb 
b/lib/puppet/application/inspect.rb
index c7be893..07ee4c3 100644
--- a/lib/puppet/application/inspect.rb
+++ b/lib/puppet/application/inspect.rb
@@ -65,7 +65,13 @@ class Puppet::Application::Inspect < Puppet::Application
         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}")
+          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
diff --git a/spec/unit/application/inspect_spec.rb 
b/spec/unit/application/inspect_spec.rb
index b931708..b3224d5 100644
--- a/spec/unit/application/inspect_spec.rb
+++ b/spec/unit/application/inspect_spec.rb
@@ -72,6 +72,26 @@ describe Puppet::Application::Inspect do
       properties.has_key?("target").should == false
     end
 
+    it "should set audited to true for all events" do
+      catalog = Puppet::Resource::Catalog.new
+      file = Tempfile.new("foo")
+      resource = Puppet::Resource.new(:file, file.path, :parameters => {:audit 
=> "all"})
+      catalog.add_resource(resource)
+      
Puppet::Resource::Catalog::Yaml.any_instance.stubs(:find).returns(catalog)
+
+      events = nil
+
+      Puppet::Transaction::Report::Rest.any_instance.expects(:save).with do 
|request|
+        events = request.instance.resource_statuses.values.first.events
+      end
+
+      @inspect.run_command
+
+      events.each do |event|
+        event.audited.should == true
+      end
+    end
+
     it "should not report irrelevent attributes if the resource is absent" do
       catalog = Puppet::Resource::Catalog.new
       file = Tempfile.new("foo")
-- 
1.7.3.1

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to