Class: InventorySync::InventoryStatus

Inherits:
HostStatus::Status
  • Object
show all
Defined in:
app/models/inventory_sync/inventory_status.rb

Constant Summary collapse

DISCONNECT =
0
SYNC =
1

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.status_nameObject



6
7
8
# File 'app/models/inventory_sync/inventory_status.rb', line 6

def self.status_name
  N_('Inventory')
end

Instance Method Details

#to_global(_options = {}) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'app/models/inventory_sync/inventory_status.rb', line 10

def to_global(_options = {})
  case status
  when DISCONNECT
    ::HostStatus::Global::WARN
  when SYNC
    ::HostStatus::Global::OK
  else
    ::HostStatus::Global::WARN
  end
end

#to_labelObject



21
22
23
24
25
26
27
28
# File 'app/models/inventory_sync/inventory_status.rb', line 21

def to_label
  case status
    when DISCONNECT
      N_('Host was not uploaded to your RH cloud inventory')
    when SYNC
      N_('Successfully uploaded to your RH cloud inventory')
  end
end

#to_status(options = {}) ⇒ Object



30
31
32
33
34
# File 'app/models/inventory_sync/inventory_status.rb', line 30

def to_status(options = {})
  # this method used to calculate status.
  # Since the calculation is done externally we should return the previously calculated status
  status
end