Class: Inspec::Resources::FreeBSD10Init
- Inherits:
-
ServiceManager
- Object
- ServiceManager
- Inspec::Resources::FreeBSD10Init
- Defined in:
- lib/inspec/resources/service.rb
Overview
Instance Attribute Summary
Attributes inherited from ServiceManager
Instance Method Summary collapse
- #info(service_name) ⇒ Object
-
#initialize(service_name, service_ctl = nil) ⇒ FreeBSD10Init
constructor
A new instance of FreeBSD10Init.
Constructor Details
#initialize(service_name, service_ctl = nil) ⇒ FreeBSD10Init
Returns a new instance of FreeBSD10Init.
536 537 538 539 |
# File 'lib/inspec/resources/service.rb', line 536 def initialize(service_name, service_ctl = nil) @service_ctl = service_ctl || "service" super end |
Instance Method Details
#info(service_name) ⇒ Object
541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 |
# File 'lib/inspec/resources/service.rb', line 541 def info(service_name) # check if service is enabled cmd = inspec.command("#{service_ctl} #{service_name} enabled") enabled = cmd.exit_status == 0 # check if the service is running # if the service is not available or not running, we always get an error code cmd = inspec.command("#{service_ctl} #{service_name} onestatus") running = cmd.exit_status == 0 { name: service_name, description: nil, installed: true, running: running, enabled: enabled, type: "bsd-init", } end |