Class: Runit
- Inherits:
-
ServiceManager
- Object
- ServiceManager
- Runit
- Defined in:
- lib/resources/service.rb
Instance Attribute Summary
Attributes inherited from ServiceManager
Instance Method Summary collapse
-
#info(service_name) ⇒ Object
rubocop:disable Style/DoubleNegation.
-
#initialize(service_name, service_ctl = nil) ⇒ Runit
constructor
A new instance of Runit.
Constructor Details
#initialize(service_name, service_ctl = nil) ⇒ Runit
Returns a new instance of Runit.
349 350 351 352 |
# File 'lib/resources/service.rb', line 349 def initialize(service_name, service_ctl = nil) @service_ctl ||= 'sv' super end |
Instance Method Details
#info(service_name) ⇒ Object
rubocop:disable Style/DoubleNegation
355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 |
# File 'lib/resources/service.rb', line 355 def info(service_name) # get the status of runit service cmd = inspec.command("#{service_ctl} status #{service_name}") # return nil unless cmd.exit_status == 0 # NOTE(sr) why do we do this? installed = cmd.exit_status == 0 running = installed && !!(cmd.stdout =~ /^run:/) enabled = installed && (running || !!(cmd.stdout =~ /normally up/) || !!(cmd.stdout =~ /want up/)) { name: service_name, description: nil, installed: installed, running: running, enabled: enabled, type: 'runit', } end |