summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2020-04-23 08:34:47 -0700
committerGitHub <noreply@github.com>2020-04-23 08:34:47 -0700
commit48acf4faf88bc5f7bef6c2087e8cf4d7dd2071cd (patch)
treea61dc6327b8cd617485d67f8d2179a7524c836f9
parent9c1c42a1ee1a71e32a9c50131aa3c698cfbbd8f3 (diff)
parent6ced523062f35f8bf6a4f98264f333ca00842bc5 (diff)
downloadchef-48acf4faf88bc5f7bef6c2087e8cf4d7dd2071cd.tar.gz
Merge pull request #9723 from jasonwbarnett/feature/backport-windows_firewall-fix
Backport #9511 to Chef 15
-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"]