Class: Inspec::Resources::MonitoringTool
- Inherits:
-
Object
- Object
- Inspec::Resources::MonitoringTool
- Defined in:
- lib/inspec/resources/service.rb
Overview
Helper class for monitored_by matcher
Instance Attribute Summary collapse
-
#inspec ⇒ Object
readonly
Returns the value of attribute inspec.
-
#service_name ⇒ Object
readonly
Returns the value of attribute service_name.
Instance Method Summary collapse
- #find_utility_or_error(utility_name) ⇒ Object
-
#initialize(inspec, service_name) ⇒ MonitoringTool
constructor
A new instance of MonitoringTool.
Constructor Details
#initialize(inspec, service_name) ⇒ MonitoringTool
Returns a new instance of MonitoringTool.
926 927 928 929 |
# File 'lib/inspec/resources/service.rb', line 926 def initialize(inspec, service_name) @inspec = inspec @service_name ||= service_name end |
Instance Attribute Details
#inspec ⇒ Object (readonly)
Returns the value of attribute inspec.
925 926 927 |
# File 'lib/inspec/resources/service.rb', line 925 def inspec @inspec end |
#service_name ⇒ Object (readonly)
Returns the value of attribute service_name.
925 926 927 |
# File 'lib/inspec/resources/service.rb', line 925 def service_name @service_name end |
Instance Method Details
#find_utility_or_error(utility_name) ⇒ Object
931 932 933 934 935 936 937 |
# File 'lib/inspec/resources/service.rb', line 931 def find_utility_or_error(utility_name) [ "/usr/sbin/#{utility_name}" , "/sbin/#{utility_name}" , "/usr/bin/#{utility_name}" , "/bin/#{utility_name}" , "#{utility_name}" ].each do |cmd| return cmd if inspec.command(cmd).exist? end raise Inspec::Exceptions::ResourceFailed, "Could not find `#{utility_name}`" end |