From c784bea6af31b2345725e6e77b749709f9016456 Mon Sep 17 00:00:00 2001 From: Matt Haught Date: Fri, 8 Nov 2019 01:47:08 -0500 Subject: [PATCH] clean up whitespace and use single-quoted strings --- lib/puppet/provider/firewall/ip6tables.rb | 2 +- lib/puppet/provider/firewall/iptables.rb | 2 +- lib/puppet/type/firewall.rb | 30 +++++++++++------------ spec/unit/puppet/type/firewall_spec.rb | 6 ++--- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/lib/puppet/provider/firewall/ip6tables.rb b/lib/puppet/provider/firewall/ip6tables.rb index 85f77df..103773f 100644 --- a/lib/puppet/provider/firewall/ip6tables.rb +++ b/lib/puppet/provider/firewall/ip6tables.rb @@ -220,7 +220,7 @@ Puppet::Type.type(:firewall).provide :ip6tables, parent: :iptables, source: :ip6 addrtype: [:src_type, :dst_type], iprange: [:src_range, :dst_range], owner: [:uid, :gid], - conntrack: [:ctstate, :ctproto, :ctorigsrc, :ctorigdst, :ctreplsrc, :ctrepldst, + conntrack: [:ctstate, :ctproto, :ctorigsrc, :ctorigdst, :ctreplsrc, :ctrepldst, :ctorigsrcport, :ctorigdstport, :ctreplsrcport, :ctrepldstport, :ctstatus, :ctexpire, :ctdir], time: [:time_start, :time_stop, :month_days, :week_days, :date_start, :date_stop, :time_contiguous, :kernel_timezone], geoip: [:src_cc, :dst_cc], diff --git a/lib/puppet/provider/firewall/iptables.rb b/lib/puppet/provider/firewall/iptables.rb index 30a1671..c1cba9d 100644 --- a/lib/puppet/provider/firewall/iptables.rb +++ b/lib/puppet/provider/firewall/iptables.rb @@ -227,7 +227,7 @@ Puppet::Type.type(:firewall).provide :iptables, parent: Puppet::Provider::Firewa addrtype: [:src_type, :dst_type], iprange: [:src_range, :dst_range], owner: [:uid, :gid], - conntrack: [:ctstate, :ctproto, :ctorigsrc, :ctorigdst, :ctreplsrc, :ctrepldst, + conntrack: [:ctstate, :ctproto, :ctorigsrc, :ctorigdst, :ctreplsrc, :ctrepldst, :ctorigsrcport, :ctorigdstport, :ctreplsrcport, :ctrepldstport, :ctstatus, :ctexpire, :ctdir], time: [:time_start, :time_stop, :month_days, :week_days, :date_start, :date_stop, :time_contiguous, :kernel_timezone], geoip: [:src_cc, :dst_cc], diff --git a/lib/puppet/type/firewall.rb b/lib/puppet/type/firewall.rb index 9beb4a7..cba598c 100644 --- a/lib/puppet/type/firewall.rb +++ b/lib/puppet/type/firewall.rb @@ -947,7 +947,7 @@ Puppet::Type.newtype(:firewall) do newproperty(:ctproto, required_features: :conntrack) do desc <<-PUPPETCODE - The specific layer-4 protocol number to match for this rule using the + The specific layer-4 protocol number to match for this rule using the conntrack module. PUPPETCODE newvalue(%r{^!?\s?\d+$}) @@ -979,9 +979,9 @@ Puppet::Type.newtype(:firewall) do begin @resource.host_to_mask(value, protocol) if protocol == :IPv4 - value.chomp("/32") + value.chomp('/32') elsif protocol == :IPv6 - value.chomp("/128") + value.chomp('/128') end rescue StandardError => e raise("host_to_ip failed for #{value}, exception #{e}") @@ -1015,9 +1015,9 @@ Puppet::Type.newtype(:firewall) do begin @resource.host_to_mask(value, protocol) if protocol == :IPv4 - value.chomp("/32") + value.chomp('/32') elsif protocol == :IPv6 - value.chomp("/128") + value.chomp('/128') end rescue StandardError => e raise("host_to_ip failed for #{value}, exception #{e}") @@ -1051,9 +1051,9 @@ Puppet::Type.newtype(:firewall) do begin @resource.host_to_mask(value, protocol) if protocol == :IPv4 - value.chomp("/32") + value.chomp('/32') elsif protocol == :IPv6 - value.chomp("/128") + value.chomp('/128') end rescue StandardError => e raise("host_to_ip failed for #{value}, exception #{e}") @@ -1087,9 +1087,9 @@ Puppet::Type.newtype(:firewall) do begin @resource.host_to_mask(value, protocol) if protocol == :IPv4 - value.chomp("/32") + value.chomp('/32') elsif protocol == :IPv6 - value.chomp("/128") + value.chomp('/128') end rescue StandardError => e raise("host_to_ip failed for #{value}, exception #{e}") @@ -1099,7 +1099,7 @@ Puppet::Type.newtype(:firewall) do newproperty(:ctorigsrcport, required_features: :conntrack) do desc <<-PUPPETCODE - The original source port to match for this filter using the conntrack module. + The original source port to match for this filter using the conntrack module. For example: ctorigsrcport => '80' @@ -1118,7 +1118,7 @@ Puppet::Type.newtype(:firewall) do newproperty(:ctorigdstport, required_features: :conntrack) do desc <<-PUPPETCODE - The original destination port to match for this filter using the conntrack module. + The original destination port to match for this filter using the conntrack module. For example: ctorigdstport => '80' @@ -1137,7 +1137,7 @@ Puppet::Type.newtype(:firewall) do newproperty(:ctreplsrcport, required_features: :conntrack) do desc <<-PUPPETCODE - The reply source port to match for this filter using the conntrack module. + The reply source port to match for this filter using the conntrack module. For example: ctreplsrcport => '80' @@ -1156,7 +1156,7 @@ Puppet::Type.newtype(:firewall) do newproperty(:ctrepldstport, required_features: :conntrack) do desc <<-PUPPETCODE - The reply destination port to match for this filter using the conntrack module. + The reply destination port to match for this filter using the conntrack module. For example: ctrepldstport => '80' @@ -1214,8 +1214,8 @@ Puppet::Type.newtype(:firewall) do newproperty(:ctdir, required_features: :conntrack) do desc <<-PUPPETCODE - Matches a packet that is flowing in the specified direction using the - conntrack module. If this flag is not specified at all, matches packets + Matches a packet that is flowing in the specified direction using the + conntrack module. If this flag is not specified at all, matches packets in both directions. Values can be: * REPLY diff --git a/spec/unit/puppet/type/firewall_spec.rb b/spec/unit/puppet/type/firewall_spec.rb index 8897b32..fbe65eb 100755 --- a/spec/unit/puppet/type/firewall_spec.rb +++ b/spec/unit/puppet/type/firewall_spec.rb @@ -439,7 +439,7 @@ describe firewall do # rubocop:disable RSpec/MultipleDescribes describe ':ctproto' do it 'accepts numeric value' do resource[:ctproto] = 6 - expect(resource[:ctproto]).to eql 6 + expect(resource[:ctproto]).to be 6 end it 'accepts negated string value' do resource[:ctproto] = '! 6' @@ -480,7 +480,7 @@ describe firewall do # rubocop:disable RSpec/MultipleDescribes describe port do it "should accept #{port} as numeric value" do resource[port] = 80 - expect(resource[port]).to eql 80 + expect(resource[port]).to be 80 end it "should accept #{port} as range value" do resource[port] = '80:81' @@ -517,7 +517,7 @@ describe firewall do # rubocop:disable RSpec/MultipleDescribes describe ':ctexpire' do it 'accepts numeric values' do resource[:ctexpire] = 100 - expect(resource[:ctexpire]).to eql 100 + expect(resource[:ctexpire]).to be 100 end it 'accepts numeric range values' do -- 2.45.2