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.
6 7 8 9 10 |
# File 'lib/foreman_maintain/utils/service/remote_db.rb', line 6 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
25 26 27 |
# File 'lib/foreman_maintain/utils/service/remote_db.rb', line 25 def disable [0, db_status("It can't be disabled.").last] end |
#enable ⇒ Object
29 30 31 |
# File 'lib/foreman_maintain/utils/service/remote_db.rb', line 29 def enable [0, db_status("It can't be enabled.").last] end |
#exist? ⇒ Boolean
55 56 57 |
# File 'lib/foreman_maintain/utils/service/remote_db.rb', line 55 def exist? true end |
#inspect ⇒ Object
16 17 18 19 |
# File 'lib/foreman_maintain/utils/service/remote_db.rb', line 16 def inspect component = @component ? ':' + @component : '' "#{self.class.name.split('::').last}(#{@name}#{component} [#{@priority}])" end |
#matches?(service) ⇒ Boolean
45 46 47 48 49 50 51 52 53 |
# File 'lib/foreman_maintain/utils/service/remote_db.rb', line 45 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
41 42 43 |
# File 'lib/foreman_maintain/utils/service/remote_db.rb', line 41 def running? status.first == 0 end |
#start ⇒ Object
33 34 35 |
# File 'lib/foreman_maintain/utils/service/remote_db.rb', line 33 def start db_status end |
#status ⇒ Object
21 22 23 |
# File 'lib/foreman_maintain/utils/service/remote_db.rb', line 21 def status db_status end |
#stop ⇒ Object
37 38 39 |
# File 'lib/foreman_maintain/utils/service/remote_db.rb', line 37 def stop [0, db_status.last] end |
#to_s ⇒ Object
12 13 14 |
# File 'lib/foreman_maintain/utils/service/remote_db.rb', line 12 def to_s @name + (@component ? " (#{@component})" : '') end |