Class: HostStatus::DlmlockStatus

Inherits:
Status
  • Object
show all
Defined in:
app/models/host_status/dlmlock_status.rb

Constant Summary collapse

OK =
0
STALE =
1

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.status_nameObject



8
9
10
# File 'app/models/host_status/dlmlock_status.rb', line 8

def self.status_name
  N_('Distributed Lock')
end

Instance Method Details

#relevant?(_options = {}) ⇒ Boolean

Returns:

  • (Boolean)


36
37
38
# File 'app/models/host_status/dlmlock_status.rb', line 36

def relevant?(_options = {})
  host.dlmlocks.any?
end

#to_global(_options = {}) ⇒ Object



23
24
25
26
27
28
29
30
# File 'app/models/host_status/dlmlock_status.rb', line 23

def to_global(_options = {})
  case to_status
  when OK
    HostStatus::Global::OK
  else
    HostStatus::Global::ERROR
  end
end

#to_label(_options = {}) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'app/models/host_status/dlmlock_status.rb', line 12

def to_label(_options = {})
  case to_status
  when OK
    N_('Ok')
  when STALE
    N_('Stale')
  else
    N_('Unknown')
  end
end

#to_status(_options = {}) ⇒ Object



32
33
34
# File 'app/models/host_status/dlmlock_status.rb', line 32

def to_status(_options = {})
  ok? ? OK : STALE
end