summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTor Magnus Rakvåg <tor.magnus@outlook.com>2019-10-07 19:12:03 +0200
committerTor Magnus Rakvåg <tor.magnus@outlook.com>2019-10-07 19:14:09 +0200
commit2f6c1141bba783b1d5ceb1a29397f28c0a7a02c4 (patch)
treeb29e8cb777a19472fcb5021ab0e5c532d3056253 /lib
parent44aa430f4e441f6aa11b6eb422cc413aa3b49e6e (diff)
downloadchef-2f6c1141bba783b1d5ceb1a29397f28c0a7a02c4.tar.gz
unkown profiles should raise a validation error
Signed-off-by: Tor Magnus Rakvåg <tor.magnus@outlook.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/chef/resource/windows_firewall_rule.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/chef/resource/windows_firewall_rule.rb b/lib/chef/resource/windows_firewall_rule.rb
index c7071e535e..0dbf9ec6b0 100644
--- a/lib/chef/resource/windows_firewall_rule.rb
+++ b/lib/chef/resource/windows_firewall_rule.rb
@@ -70,7 +70,12 @@ class Chef
property :profile, [Symbol, String, Array],
default: :any,
description: "The profile the firewall rule applies to.",
- coerce: proc { |p| Array(p).map(&:downcase).map(&:to_sym).sort }
+ coerce: proc { |p| Array(p).map(&:downcase).map(&:to_sym).sort },
+ callbacks: {
+ 'contains values not in :public, :private :domain, :any or :notapplicable' => lambda {
+ |p| p.all? { |e| %i{public private domain any notapplicable}.include?(e) }
+ }
+ }
property :program, String,
description: "The program the firewall rule applies to."