]> review.fuel-infra Code Review - puppet-modules/puppetlabs-firewall.git/commitdiff
Fix issues from the rubocop changes
authorDavid Schmitt <david.schmitt@puppet.com>
Mon, 4 Jan 2021 11:32:33 +0000 (11:32 +0000)
committerDavid Schmitt <david.schmitt@puppet.com>
Mon, 4 Jan 2021 12:04:24 +0000 (12:04 +0000)
lib/puppet/provider/firewall/iptables.rb
lib/puppet/type/firewall.rb

index dc3d28cee1ac76828a5f800991ab1d56182f97e8..662fad988cedd8c70325703f8d4bea982fa0dcc9 100644 (file)
@@ -833,7 +833,8 @@ Puppet::Type.type(:firewall).provide :iptables, parent: Puppet::Provider::Firewa
       args = args.flatten
 
       # On negations, the '!' has to be before the option (eg: "! -d 1.2.3.4")
-      if resource_value.is_a?(String) && resource_value.sub!(%r{^!\s*}, '')
+      if resource_value.is_a?(String) && resource_value.start_with?('!')
+        resource_value = resource_value.sub(%r{^!\s*}, '')
         # we do this after adding the 'dash' argument because of ones like "-m multiport --dports", where we want it before the "--dports" but after "-m multiport".
         # so we insert before whatever the last argument is
         args.insert(-2, '!')
index cd9670530d5c6f6499e8a03b6ffeb0944a5bf016..1f38384760ebdb84053361670f5cec9040243ed5 100644 (file)
@@ -2361,8 +2361,8 @@ Puppet::Type.newtype(:firewall) do
     end
 
     if value(:set_mark)
-      unless value(:jump).to_s.include?(MARK) &&
-             value(:table).to_s.include?(mangle)
+      unless value(:jump).to_s.include?('MARK') &&
+             value(:table).to_s.include?('mangle')
         raise 'Parameter set_mark only applies to ' \
           'the mangle table and when jump => MARK'
       end