summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Magnus Rakvåg <tor.magnus@outlook.com>2019-09-25 14:39:11 +0200
committerTor Magnus Rakvåg <tor.magnus@outlook.com>2019-09-25 14:39:11 +0200
commitc9826ceb8b6bdf22ffd40a280c50a888888ce86f (patch)
treefcf0e1be4221d6c20e1649c2feb4719476998990
parent0b773e76d0681f050bd493e3603268f8f6ef3a38 (diff)
downloadchef-c9826ceb8b6bdf22ffd40a280c50a888888ce86f.tar.gz
the profile property has to support arrays
Signed-off-by: Tor Magnus Rakvåg <tor.magnus@outlook.com>
-rw-r--r--lib/chef/resource/windows_firewall_rule.rb17
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/chef/resource/windows_firewall_rule.rb b/lib/chef/resource/windows_firewall_rule.rb
index 424d8d0fde..fa93403984 100644
--- a/lib/chef/resource/windows_firewall_rule.rb
+++ b/lib/chef/resource/windows_firewall_rule.rb
@@ -67,11 +67,18 @@ class Chef
description: "The action of the firewall rule.",
coerce: proc { |f| f.is_a?(String) ? f.downcase.to_sym : f }
- property :profile, [Symbol, String],
- default: :any, equal_to: %i{public private domain any notapplicable},
+ property :profile, [Symbol, String, Array],
+ default: :any,
description: "The profile the firewall rule applies to.",
- coerce: proc { |p| p.is_a?(String) ? p.downcase.to_sym : p }
-
+ coerce: proc { |p|
+ if p.is_a?(Array)
+ p.map(&:downcase).map(&:to_sym).sort
+ elsif p.is_a?(String)
+ Array(p.downcase.to_sym).sort
+ else
+ Array(p).sort
+ end
+ }
property :program, String,
description: "The program the firewall rule applies to."
@@ -158,7 +165,7 @@ class Chef
cmd << " -Direction '#{new_resource.direction}'" if new_resource.direction
cmd << " -Protocol '#{new_resource.protocol}'" if new_resource.protocol
cmd << " -Action '#{new_resource.firewall_action}'" if new_resource.firewall_action
- cmd << " -Profile '#{new_resource.profile}'" if new_resource.profile
+ cmd << " -Profile '#{new_resource.profile.join("', '")}'" if new_resource.profile
cmd << " -Program '#{new_resource.program}'" if new_resource.program
cmd << " -Service '#{new_resource.service}'" if new_resource.service
cmd << " -InterfaceType '#{new_resource.interface_type}'" if new_resource.interface_type