Class: ForemanMaintain::Utils::Service::RemoteDB
- Defined in:
- lib/foreman_maintain/utils/service/remote_db.rb
Instance Attribute Summary collapse
-
#component ⇒ Object
readonly
Returns the value of attribute component.
-
#db_feature ⇒ Object
readonly
Returns the value of attribute db_feature.
Attributes inherited from Abstract
Instance Method Summary collapse
- #disable ⇒ Object
- #enable ⇒ Object
- #exist? ⇒ Boolean
-
#initialize(name, priority, options = {}) ⇒ RemoteDB
constructor
A new instance of RemoteDB.
- #inspect ⇒ Object
- #matches?(service) ⇒ Boolean
- #running? ⇒ Boolean
- #start ⇒ Object
- #status ⇒ Object
- #stop ⇒ Object
- #to_s ⇒ Object
Methods inherited from Abstract
Constructor Details
#initialize(name, priority, options = {}) ⇒ RemoteDB
Returns a new instance of RemoteDB.
5 6 7 8 9 |
# File 'lib/foreman_maintain/utils/service/remote_db.rb', line 5 def initialize(name, priority, = {}) super @db_feature = .fetch(:db_feature) @component = .fetch(:component, nil) end |
Instance Attribute Details
#component ⇒ Object (readonly)
Returns the value of attribute component.
4 5 6 |
# File 'lib/foreman_maintain/utils/service/remote_db.rb', line 4 def component @component end |
#db_feature ⇒ Object (readonly)
Returns the value of attribute db_feature.
4 5 6 |
# File 'lib/foreman_maintain/utils/service/remote_db.rb', line 4 def db_feature @db_feature end |
Instance Method Details
#disable ⇒ Object
24 25 26 |
# File 'lib/foreman_maintain/utils/service/remote_db.rb', line 24 def disable [0, db_status("It can't be disabled.").last] end |
#enable ⇒ Object
28 29 30 |
# File 'lib/foreman_maintain/utils/service/remote_db.rb', line 28 def enable [0, db_status("It can't be enabled.").last] end |
#exist? ⇒ Boolean
54 55 56 |
# File 'lib/foreman_maintain/utils/service/remote_db.rb', line 54 def exist? true end |
#inspect ⇒ Object
15 16 17 18 |
# File 'lib/foreman_maintain/utils/service/remote_db.rb', line 15 def inspect component = @component ? ':' + @component : '' "#{self.class.name.split('::').last}(#{@name}#{component} [#{@priority}])" end |
#matches?(service) ⇒ Boolean
44 45 46 47 48 49 50 51 52 |
# File 'lib/foreman_maintain/utils/service/remote_db.rb', line 44 def matches?(service) if service.instance_of?(self.class) service.name == @name && service.component == @component elsif service.is_a? String service == @name else false end end |
#running? ⇒ Boolean
40 41 42 |
# File 'lib/foreman_maintain/utils/service/remote_db.rb', line 40 def running? status.first == 0 end |
#start ⇒ Object
32 33 34 |
# File 'lib/foreman_maintain/utils/service/remote_db.rb', line 32 def start db_status end |
#status ⇒ Object
20 21 22 |
# File 'lib/foreman_maintain/utils/service/remote_db.rb', line 20 def status db_status end |
#stop ⇒ Object
36 37 38 |
# File 'lib/foreman_maintain/utils/service/remote_db.rb', line 36 def stop [0, db_status.last] end |
#to_s ⇒ Object
11 12 13 |
# File 'lib/foreman_maintain/utils/service/remote_db.rb', line 11 def to_s @name + (@component ? " (#{@component})" : '') end |