Class: ConfigurationGroup
- Inherits:
-
Object
- Object
- ConfigurationGroup
- Includes:
- Mongoid::Document, Mongoid::Timestamps
- Defined in:
- lib/models/configuration_group.rb
Overview
Hold a collection of app configuration items as a group.
Contains the actual key value pairs as well as the rules that apply to this configuration group.
Instance Method Summary collapse
-
#agent_payload ⇒ Object
Return the configuration doc for the agent.
-
#match_agent?(agent) ⇒ Boolean
Return true if the configuration rules match this agent.
Instance Method Details
#agent_payload ⇒ Object
Return the configuration doc for the agent
47 48 49 |
# File 'lib/models/configuration_group.rb', line 47 def agent_payload { name: name, version: version, items: .collect(&:agent_payload) } end |
#match_agent?(agent) ⇒ Boolean
Return true if the configuration rules match this agent
34 35 36 37 38 39 40 41 42 |
# File 'lib/models/configuration_group.rb', line 34 def match_agent?(agent) return false unless active? match = true configuration_rules.where(active: true).each { |rule| match &&= rule.match_agent?(agent) } match rescue StandardError false end |