Commit be3a205c authored by Karel Březina's avatar Karel Březina

(PDB-2495) Leverage noop flag from puppet report when the flag is available

The flag is set to true if the corresponding puppet run was stared in noop mode.
parent e63d8d2b
......@@ -38,7 +38,7 @@ Puppet::Reports.register_report(:puppetdb) do
end
resources = build_resources_list
is_noop = resources.any? { |rs| has_noop_event?(rs) } && resources.none? { |rs| has_enforcement_event?(rs) }
is_noop = defined?(noop) ? noop : resources.any? { |rs| has_noop_event?(rs) } && resources.none? { |rs| has_enforcement_event?(rs) }
defaulted_catalog_uuid = defined?(catalog_uuid) ? catalog_uuid : transaction_uuid
......
......@@ -109,6 +109,30 @@ describe processor do
end
end
it "should include truthy noop flag" do
if defined?(subject.noop) then
subject.noop = true
else
event = Puppet::Transaction::Event.new
event.status = "noop"
status.add_event(event)
end
result = subject.send(:report_to_hash)
result["noop"].should == true
end
it "should include falsey noop flag" do
if defined?(subject.noop) then
subject.noop = false
else
event = Puppet::Transaction::Event.new
event.status = "success"
status.add_event(event)
end
result = subject.send(:report_to_hash)
result["noop"].should == false
end
context "start/end time" do
before :each do
subject.add_metric("time", {"total" => 10})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment