From 753b174888d9c0a4a16774f31a03043cf6e2dfcf Mon Sep 17 00:00:00 2001 From: Cameron Johnston Date: Tue, 14 Mar 2017 14:39:27 -0600 Subject: [PATCH] [sensu_check] fix conditional validation of subscribers/standalone (#547) * [sensu_check] fix conditional validation of required subscribers/standalone attribute * [sensu_check] ensure action is an array before checking for :create --- resources/check.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/check.rb b/resources/check.rb index 652f226e..f7f9c6dd 100644 --- a/resources/check.rb +++ b/resources/check.rb @@ -23,7 +23,7 @@ def after_created raise Chef::Exceptions::ValidationFailed, "Sensu check #{name}: name cannot contain spaces or special characters" end - if action == :create + if [action].compact.flatten.include?(:create) raise Chef::Exceptions::ValidationFailed, "Sensu check #{name}: must either define subscribers, or has to be standalone." unless (subscribers || standalone) end end