diff options
author | Patrick Schaumburg <info@p-schaumburg.de> | 2019-11-16 10:18:10 +0100 |
---|---|---|
committer | Patrick Schaumburg <info@p-schaumburg.de> | 2019-11-16 10:18:10 +0100 |
commit | 11a4a3ba67e4bb3eaf0b83669920836cebc5806a (patch) | |
tree | 92c797ffc87151aabf04055d82869b8f6f9853ec /lib/chef/resource/windows_firewall_rule.rb | |
parent | 982caf0017efa0918a967dfca53da12fc97b23d4 (diff) | |
parent | a846c6ae160829ff9dd46d9e61137d624e729ea0 (diff) | |
download | chef-11a4a3ba67e4bb3eaf0b83669920836cebc5806a.tar.gz |
Merge branch 'master' into ps/windows_firewall_rule-group
Diffstat (limited to 'lib/chef/resource/windows_firewall_rule.rb')
-rw-r--r-- | lib/chef/resource/windows_firewall_rule.rb | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/chef/resource/windows_firewall_rule.rb b/lib/chef/resource/windows_firewall_rule.rb index 4d1db9990c..c3185d7c37 100644 --- a/lib/chef/resource/windows_firewall_rule.rb +++ b/lib/chef/resource/windows_firewall_rule.rb @@ -71,10 +71,15 @@ 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| Array(p).map(&:downcase).map(&:to_sym).sort }, + callbacks: { + "contains values not in :public, :private :domain, :any or :notapplicable" => lambda { |p| + p.all? { |e| %i{public private domain any notapplicable}.include?(e) } + }, + } property :program, String, description: "The program the firewall rule applies to." @@ -163,13 +168,13 @@ class Chef cmd << " -Group '#{new_resource.group}'" if new_resource.group && cmdlet_type == "New" cmd << " -Description '#{new_resource.description}'" if new_resource.description cmd << " -LocalAddress '#{new_resource.local_address}'" if new_resource.local_address - cmd << " -LocalPort #{new_resource.local_port.join(",")}" if new_resource.local_port + cmd << " -LocalPort '#{new_resource.local_port.join("', '")}'" if new_resource.local_port cmd << " -RemoteAddress '#{new_resource.remote_address}'" if new_resource.remote_address - cmd << " -RemotePort #{new_resource.remote_port.join(",")}" if new_resource.remote_port + cmd << " -RemotePort '#{new_resource.remote_port.join("', '")}'" if new_resource.remote_port 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 |