puppetlabs / puppetlabs-firewall

Puppet Firewall Module
http://forge.puppetlabs.com/puppetlabs/firewall
Apache License 2.0
269 stars 455 forks source link

Ensure global variables are unique among providers #1227

Open nabertrand opened 3 days ago

nabertrand commented 3 days ago

Summary

Some global variable names were re-used between the firewall and firewallchain providers. This causes intermittent catalog application failures.

The proposed fix is to prefix all firewall global variables with fw_ and all firewallchain global variables with fwc_.

Additional Context

For example, if the firewallchain provider code is loaded after the firewall provider code, the $list_command global variable value loses the iptables and ipt6ables keys and values. E.g. https://github.com/puppetlabs/puppetlabs-firewall/blob/810e7fac43d0e752378be56419a87d6339c0aedf/lib/puppet/provider/firewall/firewall.rb#L11-L16 becomes https://github.com/puppetlabs/puppetlabs-firewall/blob/810e7fac43d0e752378be56419a87d6339c0aedf/lib/puppet/provider/firewallchain/firewallchain.rb#L10-L13 Then when the firewall provider tries to process a rule that has the iptables protocol, the provider is unable to lookup the current rules because $list_command['iptables'] is no longer defined.

Related Issues (if any)

Mention any related issues or pull requests.

Checklist