summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Heinen <theinen@tecracer.de>2020-03-19 19:35:22 +0100
committerJason Barnett <jason.w.barnett@gmail.com>2020-04-23 10:23:35 -0400
commit6ced523062f35f8bf6a4f98264f333ca00842bc5 (patch)
treea61dc6327b8cd617485d67f8d2179a7524c836f9
parent9c1c42a1ee1a71e32a9c50131aa3c698cfbbd8f3 (diff)
downloadchef-6ced523062f35f8bf6a4f98264f333ca00842bc5.tar.gz
Backport #9511 to Chef 15
Signed-off-by: Jason Barnett <jason.w.barnett@gmail.com>
-rw-r--r--lib/chef/resource/windows_firewall_rule.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/chef/resource/windows_firewall_rule.rb b/lib/chef/resource/windows_firewall_rule.rb
index f926f9ff40..32938c227b 100644
--- a/lib/chef/resource/windows_firewall_rule.rb
+++ b/lib/chef/resource/windows_firewall_rule.rb
@@ -72,7 +72,7 @@ class Chef
description: "The profile the firewall rule applies to.",
coerce: proc { |p| Array(p).map(&:downcase).map(&:to_sym).sort },
callbacks: {
- "contains values not in :public, :private :domain, :any or :notapplicable" => lambda { |p|
+ "contains values not in :public, :private, :domain, :any or :notapplicable" => lambda { |p|
p.all? { |e| %i{public private domain any notapplicable}.include?(e) }
},
}
@@ -106,6 +106,10 @@ class Chef
else
state = Chef::JSONCompat.from_json(output.stdout)
end
+
+ # Need to reverse `$rule.Profile.ToString()` in powershell command
+ current_profiles = state["profile"].split(", ").map(&:to_sym)
+
local_address state["local_address"]
local_port Array(state["local_port"]).sort
remote_address state["remote_address"]
@@ -113,7 +117,7 @@ class Chef
direction state["direction"]
protocol state["protocol"]
firewall_action state["firewall_action"]
- profile state["profile"]
+ profile current_profiles
program state["program"]
service state["service"]
interface_type state["interface_type"]