Class: ForemanOmaha::StatusMapper
- Inherits:
-
Object
- Object
- ForemanOmaha::StatusMapper
- Defined in:
- app/services/foreman_omaha/status_mapper.rb
Instance Attribute Summary collapse
-
#status ⇒ Object
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(status) ⇒ StatusMapper
constructor
A new instance of StatusMapper.
- #to_description(version = nil) ⇒ Object
- #to_label ⇒ Object
Constructor Details
#initialize(status) ⇒ StatusMapper
Returns a new instance of StatusMapper.
7 8 9 |
# File 'app/services/foreman_omaha/status_mapper.rb', line 7 def initialize(status) @status = status end |
Instance Attribute Details
#status ⇒ Object
Returns the value of attribute status.
5 6 7 |
# File 'app/services/foreman_omaha/status_mapper.rb', line 5 def status @status end |
Instance Method Details
#to_description(version = nil) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'app/services/foreman_omaha/status_mapper.rb', line 30 def to_description(version = nil) case status.to_sym when :complete if version.present? _('The host has been updated successfully and is now running version %s.') % version else _('The host has been updated successfully.') end when :downloading _('The host has just started downloading the update package.') when :downloaded _('The host has downloaded the update package and will install it now.') when :installed _('The host has installed the update package but is not using it yet.') when :instance_hold _('An update for this host is pending but it was put on hold because of the rollout policy.') when :error _('The host reported an error while updating.') else _('The status of this host is unknown.') end end |
#to_label ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/services/foreman_omaha/status_mapper.rb', line 11 def to_label case status.to_sym when :complete N_('Complete') when :downloading N_('Downloading') when :downloaded N_('Downloaded') when :installed N_('Installed') when :instance_hold N_('Instance Hold') when :error N_('Error') else N_('unknown') end end |