Class: Inspec::Resources::Svcs
- Inherits:
-
ServiceManager
- Object
- ServiceManager
- Inspec::Resources::Svcs
- Defined in:
- lib/inspec/resources/service.rb
Overview
Solaris services
Instance Attribute Summary
Attributes inherited from ServiceManager
Instance Method Summary collapse
- #info(service_name) ⇒ Object
-
#initialize(service_name, service_ctl = nil) ⇒ Svcs
constructor
A new instance of Svcs.
Constructor Details
#initialize(service_name, service_ctl = nil) ⇒ Svcs
Returns a new instance of Svcs.
749 750 751 752 |
# File 'lib/inspec/resources/service.rb', line 749 def initialize(service_name, service_ctl = nil) @service_ctl = service_ctl || "svcs" super end |
Instance Method Details
#info(service_name) ⇒ Object
754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 |
# File 'lib/inspec/resources/service.rb', line 754 def info(service_name) # get the status of runit service cmd = inspec.command("#{service_ctl} -l #{service_name}") return nil if cmd.exit_status != 0 params = SimpleConfig.new( cmd.stdout.chomp, assignment_regex: /^(\w+)\s*(.*)$/, multiple_values: false ).params installed = cmd.exit_status == 0 running = installed && (params["state"] == "online") enabled = installed && (params["enabled"] == "true") { name: service_name, description: params["name"], installed: installed, running: running, enabled: enabled, type: "svcs", } end |