chef-boneyard / windows_firewall

Chef cookbook to configure Windows Firewall
Apache License 2.0
6 stars 9 forks source link

Option profile must be equal to one of: public, private, domain, any! You passed "any". #28

Closed jmilacek closed 5 years ago

jmilacek commented 5 years ago

Cookbook version

4.0.2

Chef-client version

14.3.37

Platform Details

Windows Server 2012R2

Scenario:

Trying to apply firewall rule to all profiles.

Steps to Reproduce:

windows_firewall_rule 'Jamf Pro' do rule_name 'Jamf Pro' localport '8443' protocol 'TCP' profile 'any' firewall_action :allow end

Expected Result:

Firewall rule applied to all profiles.

Actual Result:

Compiling Cookbooks... [2018-09-25T15:42:27-04:00] INFO: Using chef-client binary at C:/opscode/chef/bin/chef-client

================================================================================ Recipe Compile Error in c:/chef/cache/cookbooks/fisher-server-jss/recipes/default.rb

Chef::Exceptions::ValidationFailed

Option profile must be equal to one of: public, private, domain, any! You passed "any".

Cookbook Trace:

c:/chef/cache/cookbooks/fisher-server-jss/recipes/default.rb:17:in block in from_file' c:/chef/cache/cookbooks/fisher-server-jss/recipes/default.rb:13:infrom_file'

Relevant File Content:

c:/chef/cache/cookbooks/fisher-server-jss/recipes/default.rb:

10: include_recipe 'fisher-role-server2012r2-base' 11: 12: #allow access on 8443 13: windows_firewall_rule 'Jamf Pro' do 14: rule_name 'Jamf Pro' 15: localport '8443' 16: protocol 'TCP' 17>> profile 'any' 18: firewall_action :allow 19: end 20:

System Info:

chef_version=14.3.37 platform=windows platform_version=6.3.9600 ruby=ruby 2.5.1p57 (2018-03-29 revision 63029) [x64-mingw32] program_name=C:/opscode/chef/bin/chef-client executable=C:/opscode/chef/bin/chef-client

jugatsu commented 5 years ago

You should use :any not 'any'.

See https://github.com/chef-cookbooks/windows_firewall/blob/master/resources/rule.rb#L27

tas50 commented 5 years ago

Yeah this is a hard one. Chef is just taking the available values and printing them out, but when you print out a symbol in ruby it just prints it as a string. We probably need some more logic in the Chef client to handle this and properly print out the options as strings.