Class: InventorySync::InventoryStatus
- Inherits:
-
HostStatus::Status
- Object
- HostStatus::Status
- InventorySync::InventoryStatus
- Defined in:
- app/models/inventory_sync/inventory_status.rb
Constant Summary collapse
- DISCONNECT =
0- SYNC =
1- USER_OMITTED =
2
Class Method Summary collapse
Instance Method Summary collapse
- #relevant?(_options = {}) ⇒ Boolean
- #to_global(_options = {}) ⇒ Object
- #to_label ⇒ Object
- #to_status(options = {}) ⇒ Object
Class Method Details
.status_name ⇒ Object
7 8 9 |
# File 'app/models/inventory_sync/inventory_status.rb', line 7 def self.status_name N_('Inventory') end |
Instance Method Details
#relevant?(_options = {}) ⇒ Boolean
42 43 44 45 46 |
# File 'app/models/inventory_sync/inventory_status.rb', line 42 def relevant?( = {}) # Inventory status is not relevant in IoP mode since we use single-host reports # that don't sync with the cloud inventory service !ForemanRhCloud.with_iop_smart_proxy? end |
#to_global(_options = {}) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/models/inventory_sync/inventory_status.rb', line 11 def to_global( = {}) case status when DISCONNECT ::HostStatus::Global::WARN when SYNC ::HostStatus::Global::OK when USER_OMITTED ::HostStatus::Global::OK else ::HostStatus::Global::WARN end end |
#to_label ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'app/models/inventory_sync/inventory_status.rb', line 24 def to_label case status when DISCONNECT N_('Host is not present on console.redhat.com Inventory service') when SYNC N_('Host is uploaded and present on console.redhat.com Inventory service') when USER_OMITTED N_('Host is excluded from upload to console.redhat.com Inventory service due to host parameter') end end |
#to_status(options = {}) ⇒ Object
35 36 37 38 39 40 |
# File 'app/models/inventory_sync/inventory_status.rb', line 35 def to_status( = {}) # Normally, this method is used to calculate status. # In foreman_rh_cloud 'we do things a bit differently around here.' # Calculation is done externally in InventorySync::Async::InventoryFullSync, so we simply return the previously calculated status. status end |