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.
930 931 932 933 |
# File 'lib/inspec/resources/service.rb', line 930 def initialize(inspec, service_name) @inspec = inspec @service_name ||= service_name end |
Instance Attribute Details
#inspec ⇒ Object (readonly)
Returns the value of attribute inspec.
929 930 931 |
# File 'lib/inspec/resources/service.rb', line 929 def inspec @inspec end |
#service_name ⇒ Object (readonly)
Returns the value of attribute service_name.
929 930 931 |
# File 'lib/inspec/resources/service.rb', line 929 def service_name @service_name end |
Instance Method Details
#find_utility_or_error(utility_name) ⇒ Object
935 936 937 938 939 940 941 |
# File 'lib/inspec/resources/service.rb', line 935 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 |