Class: HostStatus::OmahaStatus
- Inherits:
-
Status
- Object
- Status
- HostStatus::OmahaStatus
- Defined in:
- app/models/host_status/omaha_status.rb
Class Method Summary collapse
Instance Method Summary collapse
- #relevant?(_options = {}) ⇒ Boolean
- #to_global(_options = {}) ⇒ Object
- #to_label(_options = {}) ⇒ Object
- #to_status(_options = {}) ⇒ Object
Class Method Details
.status_name ⇒ Object
5 6 7 |
# File 'app/models/host_status/omaha_status.rb', line 5 def self.status_name N_('Omaha Status') end |
Instance Method Details
#relevant?(_options = {}) ⇒ Boolean
34 35 36 |
# File 'app/models/host_status/omaha_status.rb', line 34 def relevant?( = {}) host && !!host.omaha_facet end |
#to_global(_options = {}) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/models/host_status/omaha_status.rb', line 15 def to_global( = {}) return ::ForemanOmaha::OmahaFacet.statuses[:unknown] unless relevant? case host.omaha_facet.status.to_sym when :complete, :downloaded, :downloading, :installed HostStatus::Global::OK when :instance_hold HostStatus::Global::WARN when :error HostStatus::Global::ERROR else HostStatus::Global::OK end end |
#to_label(_options = {}) ⇒ Object
30 31 32 |
# File 'app/models/host_status/omaha_status.rb', line 30 def to_label( = {}) host.omaha_facet.to_status_label end |
#to_status(_options = {}) ⇒ Object
9 10 11 12 13 |
# File 'app/models/host_status/omaha_status.rb', line 9 def to_status( = {}) return ::ForemanOmaha::OmahaFacet.statuses[:unknown] unless relevant? ::ForemanOmaha::OmahaFacet.statuses[host.omaha_facet.status] end |