diff options
author | Thomas Heinen <theinen@tecracer.de> | 2020-03-19 19:35:22 +0100 |
---|---|---|
committer | Thomas Heinen <theinen@tecracer.de> | 2020-03-19 19:35:22 +0100 |
commit | 9cbd0771f528f09ebf1f66727067ea2449e07403 (patch) | |
tree | 19b790aea4f5313b06de2c5e209c3129fd2d60d6 /lib/chef/resource/windows_firewall_rule.rb | |
parent | 44ad9264d78877c99b1304f8826c208f240c1eeb (diff) | |
download | chef-9cbd0771f528f09ebf1f66727067ea2449e07403.tar.gz |
Fix windows_firewall_rule resource for rules with multiple associated profiles
Signed-off-by: Thomas Heinen <theinen@tecracer.de>
Diffstat (limited to 'lib/chef/resource/windows_firewall_rule.rb')
-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"] |