From f5afe100172c6e147416be89dc9dcebfc7f63e7f Mon Sep 17 00:00:00 2001 From: Sonu Saha Date: Tue, 12 Apr 2022 10:07:25 +0530 Subject: [PATCH] CFINSPEC-93: Add comments and exception guard clause for new matcher Signed-off-by: Sonu Saha --- lib/inspec/resources/service.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/inspec/resources/service.rb b/lib/inspec/resources/service.rb index 075e21ed5..bb80bafaf 100644 --- a/lib/inspec/resources/service.rb +++ b/lib/inspec/resources/service.rb @@ -274,11 +274,16 @@ module Inspec::Resources # matcher equivalent to startmode property; compares start-up mode # supported only on windows. def has_start_mode?(mode) + raise Inspec::Exceptions::ResourceSkipped, "The `has_start_mode` matcher is not supported on your OS yet." unless inspec.os.windows? + mode == startmode end # matcher to check if the service is monitored by the given monitoring tool/software def monitored_by?(monitoring_tool) + # Currently supported monitoring tools are: monit & god + # To add support for new monitoring tools, extend the case statement with additional monitoring tool and + # add the definition and logic in a new class (inheriting the base class MonitoringTool: optional) case monitoring_tool when "monit" current_monitoring_tool = Monit.new(inspec, @service_name)