Class: Inspec::Resources::Upstart
- Inherits:
-
ServiceManager
- Object
- ServiceManager
- Inspec::Resources::Upstart
- Includes:
- FileReader
- Defined in:
- lib/inspec/resources/service.rb
Overview
@see: upstart.ubuntu.com
Instance Attribute Summary
Attributes inherited from ServiceManager
Instance Method Summary collapse
- #info(service_name) ⇒ Object
-
#initialize(service_name, service_ctl = nil) ⇒ Upstart
constructor
A new instance of Upstart.
Methods included from FileReader
Constructor Details
#initialize(service_name, service_ctl = nil) ⇒ Upstart
Returns a new instance of Upstart.
420 421 422 423 |
# File 'lib/inspec/resources/service.rb', line 420 def initialize(service_name, service_ctl = nil) @service_ctl = service_ctl || "initctl" super end |
Instance Method Details
#info(service_name) ⇒ Object
425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 |
# File 'lib/inspec/resources/service.rb', line 425 def info(service_name) # get the status of upstart service status = inspec.command("#{service_ctl} status #{service_name}") # fallback for systemv services, those are not handled via `initctl` return SysV.new(inspec).info(service_name) if status.exit_status.to_i != 0 || status.stdout == "" # @see: http://upstart.ubuntu.com/cookbook/#job-states # grep for running to indicate the service is there running = !status.stdout[%r{start/running}].nil? enabled = info_enabled(service_name) { name: service_name, description: nil, installed: true, running: running, enabled: enabled, type: "upstart", } end |