Class: Puppet::Util::Puppetdb::Blacklist
- Inherits:
-
Object
- Object
- Puppet::Util::Puppetdb::Blacklist
- Defined in:
- lib/puppet/util/puppetdb/blacklist.rb
Defined Under Namespace
Classes: BlacklistedEvent
Constant Summary collapse
- BlacklistedEvents =
Initialize our blacklist of events to filter out of reports. This is needed because older versions of puppet always generate a swath of (meaningless) ‘skipped’ Schedule events on every agent run. As of puppet 3.3, these events should no longer be generated, but this is here for backward compat.
[BlacklistedEvent.new("Schedule", "never", "skipped", nil), BlacklistedEvent.new("Schedule", "puppet", "skipped", nil), BlacklistedEvent.new("Schedule", "hourly", "skipped", nil), BlacklistedEvent.new("Schedule", "daily", "skipped", nil), BlacklistedEvent.new("Schedule", "weekly", "skipped", nil), BlacklistedEvent.new("Schedule", "monthly", "skipped", nil)]
Instance Method Summary collapse
-
#initialize(events) ⇒ Blacklist
constructor
A new instance of Blacklist.
- #is_event_blacklisted?(event) ⇒ Boolean
Constructor Details
#initialize(events) ⇒ Blacklist
Returns a new instance of Blacklist.
18 19 20 21 22 23 24 25 26 |
# File 'lib/puppet/util/puppetdb/blacklist.rb', line 18 def initialize(events) @events = events.inject({}) do |m, e| m[e.resource_type] ||= {} m[e.resource_type][e.resource_title] ||= {} m[e.resource_type][e.resource_title][e.status] ||= {} m[e.resource_type][e.resource_title][e.status][e.property] = true m end end |
Instance Method Details
#is_event_blacklisted?(event) ⇒ Boolean
28 29 30 31 32 33 |
# File 'lib/puppet/util/puppetdb/blacklist.rb', line 28 def is_event_blacklisted?(event) @events.fetch(event["resource-type"], {}). fetch(event["resource-title"], {}). fetch(event["status"], {}). fetch(event["property"], false) end |