]> review.fuel-infra Code Review - puppet-modules/puppetlabs-firewall.git/commitdiff
(GH-1055) Fix for `--random-fully`
authordavid22swan <david.swan@puppet.com>
Wed, 13 Jul 2022 10:35:53 +0000 (11:35 +0100)
committerdavid22swan <david.swan@puppet.com>
Wed, 28 Sep 2022 08:49:31 +0000 (09:49 +0100)
Issues have arisen with the --random-fully value on certain RedHat versions.
It seem's as if the logic put in around `--random` and `--random-fully` are no longer working.
This change should resolve the issue and tighten the logic around the `known_boolean` values.

lib/puppet/provider/firewall/iptables.rb

index 9b9c3016282c59b26d465338ee61ea8f194b6952..65265f1f5b64d22ee3c30a6b7cd27970df10084c 100644 (file)
@@ -549,11 +549,9 @@ Puppet::Type.type(:firewall).provide :iptables, parent: Puppet::Provider::Firewa
                  values.sub(%r{\s-f(?!l)(?=.*--comment)}, ' -f true')
                elsif resource_map[bool].eql?(%r{'--physdev-is-\S+'})
                  values.sub(%r{'#{resource_map[bool]} "! "'}, "#{resource_map[bool]} true")
-               elsif bool == :random
-                 values.sub(%r{#{resource_map[bool]}(\s|$)(?!"!")}, "#{resource_map[bool]} true")
                else
                  # append `true` to booleans that are not already negated (followed by "!")
-                 values.sub(%r{#{resource_map[bool]}(?"!")}, "#{resource_map[bool]} true")
+                 values.sub(%r{#{resource_map[bool]}(?=\s|$)(?!"!")}, "#{resource_map[bool]} true")
                end
     end