Commit df22f0f8 authored by Karel Březina's avatar Karel Březina Committed by Wyatt Alt

(PE-17059) Make sure that reports.noop flag is always set.

Is was discovered that the latest PDB terminus with an older puppet agent can produce reports with noop set to nil. When noop flag in not defined or is nil in Puppet report the original PuppetDB heuristic needs to be used to set the flag.
parent 788cfd7b
......@@ -38,7 +38,9 @@ Puppet::Reports.register_report(:puppetdb) do
end
resources = build_resources_list
is_noop = defined?(noop) ? noop : resources.any? { |rs| has_noop_event?(rs) } && resources.none? { |rs| has_enforcement_event?(rs) }
is_noop = (defined?(noop) && (not noop.nil?)) ?
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
defaulted_code_id = defined?(code_id) ? code_id : nil
......
......@@ -146,7 +146,7 @@ describe processor do
end
it "should include truthy noop flag" do
unless defined?(subject.noop) then
unless (defined?(subject.noop) && (not subject.noop.nil?)) then
event = Puppet::Transaction::Event.new
event.status = "noop"
status.add_event(event)
......@@ -162,7 +162,7 @@ describe processor do
end
it "should include falsey noop flag" do
unless defined?(subject.noop) then
unless (defined?(subject.noop) && (not subject.noop.nil?)) then
event = Puppet::Transaction::Event.new
event.status = "success"
status.add_event(event)
......
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