iptables cookbooks breaks at load time if it's in the dependency tree on non-linux platforms
jjustice6 opened this issue · comments
Cookbook version
6.0.0
Chef-client version
irrelevant
Platform Details
anything not in https://github.com/chef-cookbooks/iptables/blob/master/attributes/default.rb#L41-L48
Scenario:
Run chef.
Steps to Reproduce:
Use a cookbook, such as openssh, which depends on the iptables
cookbook but runs on a platform that iptables doesn't support.
Update to iptables 6.0.0 in a policy (or whatever) and run chef.
Expected Result:
Chef converges with no major changes.
Actual Result:
Chef blows up at load time with
================================================================================
Recipe Compile Error in C:/chef/cache/cookbooks/iptables/resources/chain.rb
================================================================================
Chef::Exceptions::ValidationFailed
----------------------------------
Property config_file must be one of: String! You passed nil.
This points to https://github.com/chef-cookbooks/iptables/blob/master/resources/chain.rb#L23 , which specifies that the default value is an attribute, which comes from https://github.com/chef-cookbooks/iptables/blob/master/attributes/default.rb#L41-L48
Suggested Fix
Change it to default: node['iptables']['persisted_rules_iptables'].to_s
?
Obviously the cookbook doesn't support these other OSes and doesn't run on them, but it can get in the dependency tree with shared cookbooks and blow up at load time, which is awful.
We've observed this on Windows, AIX, and Solaris, example error above from Windows. (Note that AIX is supported by the openssh cookbook, so this technically breaks that!)
Hey There
It looks like this is the first issue you've filed against the chef-cookbooks project. I'm here to offer you a bit of extra help to make sure we can quickly get back to you.
Make sure you've filled out all the fields in our issue template. Make sure you've provided us with the version of chef-client you're running, your operating system and the version of the cookbook. If you're not using the most up to date version of the cookbook then please make sure to update first. Lots of things change between versions even if you're issue isn't listed in the changelog. Finally please give us a detailed description of the issue you're having. The more we know about what you're trying to do, what actually happens, and how you can reproduce the problem, the better.
If you're looking for more immediate troubleshooting help make sure to check out #general on the Chef Community Slack. There's plenty of folks there willing to lend a helping hand. Thanks for the first issue. We hope we can get back to you soon with a solution.