Class: Katello::Candlepin::SystemPurpose
- Inherits:
-
Object
- Object
- Katello::Candlepin::SystemPurpose
- Defined in:
- app/services/katello/candlepin/system_purpose.rb
Instance Attribute Summary collapse
-
#compliance ⇒ Object
readonly
Returns the value of attribute compliance.
Instance Method Summary collapse
- #addons_status ⇒ Object
-
#initialize(purpose_compliance) ⇒ SystemPurpose
constructor
the purpose compliance of a consumer and via event queue are in the same format so we can parse them identically.
- #overall_status ⇒ Object
- #purpose_status(compliant, noncompliant) ⇒ Object
- #role_status ⇒ Object
- #sla_status ⇒ Object
- #usage_status ⇒ Object
Constructor Details
#initialize(purpose_compliance) ⇒ SystemPurpose
the purpose compliance of a consumer and via event queue are in the same format so we can parse them identically
8 9 10 |
# File 'app/services/katello/candlepin/system_purpose.rb', line 8 def initialize(purpose_compliance) @compliance = purpose_compliance end |
Instance Attribute Details
#compliance ⇒ Object (readonly)
Returns the value of attribute compliance.
4 5 6 |
# File 'app/services/katello/candlepin/system_purpose.rb', line 4 def compliance @compliance end |
Instance Method Details
#addons_status ⇒ Object
34 35 36 |
# File 'app/services/katello/candlepin/system_purpose.rb', line 34 def addons_status purpose_status(compliance['compliantAddons'], compliance['nonCompliantAddons']) end |
#overall_status ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'app/services/katello/candlepin/system_purpose.rb', line 12 def overall_status if compliance['status'] == 'not specified' :not_specified elsif compliance['status'] == 'matched' :matched elsif compliance['status'] == 'mismatched' :mismatched end end |
#purpose_status(compliant, noncompliant) ⇒ Object
38 39 40 41 42 43 44 45 46 |
# File 'app/services/katello/candlepin/system_purpose.rb', line 38 def purpose_status(compliant, noncompliant) if (noncompliant.nil? || noncompliant.try(:empty?)) && compliant.empty? :not_specified elsif noncompliant.nil? || noncompliant.try(:empty?) :matched elsif noncompliant.present? :mismatched end end |
#role_status ⇒ Object
26 27 28 |
# File 'app/services/katello/candlepin/system_purpose.rb', line 26 def role_status purpose_status(compliance['compliantRole'], compliance['nonCompliantRole']) end |
#sla_status ⇒ Object
22 23 24 |
# File 'app/services/katello/candlepin/system_purpose.rb', line 22 def sla_status purpose_status(compliance['compliantSLA'], compliance['nonCompliantSLA']) end |
#usage_status ⇒ Object
30 31 32 |
# File 'app/services/katello/candlepin/system_purpose.rb', line 30 def usage_status purpose_status(compliance['compliantUsage'], compliance['nonCompliantUsage']) end |