diff options
author | Tim Smith <tsmith@chef.io> | 2020-03-19 14:02:33 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-19 14:02:33 -0700 |
commit | af87e78c46b1676ebfab6422c01651273d0f7362 (patch) | |
tree | 5745f057360091a88052c342550a462b4a809c89 | |
parent | 4f9f4639e81dc68d893d3194d17122ac41f993e5 (diff) | |
parent | 9cbd0771f528f09ebf1f66727067ea2449e07403 (diff) | |
download | chef-af87e78c46b1676ebfab6422c01651273d0f7362.tar.gz |
Merge pull request #9511 from tecracer/theinen/fix-windows-firewall-rule
Fix windows_firewall_rule resource for rules with multiple profiles
-rw-r--r-- | lib/chef/resource/windows_firewall_rule.rb | 8 |
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 70610b2889..3d961a6e82 100644 --- a/lib/chef/resource/windows_firewall_rule.rb +++ b/lib/chef/resource/windows_firewall_rule.rb @@ -76,7 +76,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) } }, } @@ -110,6 +110,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) + group state["group"] local_address state["local_address"] local_port Array(state["local_port"]).sort @@ -118,7 +122,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"] |