From: David Schmitt Date: Mon, 4 Jan 2021 11:32:33 +0000 (+0000) Subject: Fix issues from the rubocop changes X-Git-Tag: v2.8.1~3^2~1 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=a190c127e7c540bd4614f4c2febd7be035fc8f32;p=puppet-modules%2Fpuppetlabs-firewall.git Fix issues from the rubocop changes --- diff --git a/lib/puppet/provider/firewall/iptables.rb b/lib/puppet/provider/firewall/iptables.rb index dc3d28c..662fad9 100644 --- a/lib/puppet/provider/firewall/iptables.rb +++ b/lib/puppet/provider/firewall/iptables.rb @@ -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, '!') diff --git a/lib/puppet/type/firewall.rb b/lib/puppet/type/firewall.rb index cd96705..1f38384 100644 --- a/lib/puppet/type/firewall.rb +++ b/lib/puppet/type/firewall.rb @@ -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