Sha256: 1aa2d1e5e584e4c3c657aa0d1fb5dd835ae3b212c3f9f7713bcdf01a6d475e76

Contents?: true

Size: 803 Bytes

Versions: 6

Compression:

Stored size: 803 Bytes

Contents

module InventorySync
  class InventoryStatus < HostStatus::Status
    DISCONNECT = 0
    SYNC = 1

    def self.status_name
      N_('Inventory')
    end

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

    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

    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
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
foreman_rh_cloud-10.0.3 app/models/inventory_sync/inventory_status.rb
foreman_rh_cloud-11.0.3 app/models/inventory_sync/inventory_status.rb
foreman_rh_cloud-11.0.2 app/models/inventory_sync/inventory_status.rb
foreman_rh_cloud-11.0.1 app/models/inventory_sync/inventory_status.rb
foreman_rh_cloud-11.0.0 app/models/inventory_sync/inventory_status.rb
foreman_rh_cloud-10.0.2 app/models/inventory_sync/inventory_status.rb