From: Jonathan Tripathy Date: Tue, 30 Jun 2015 13:43:41 +0000 (+0100) Subject: Only catch changes if not EL5 due to selinux warning issue. X-Git-Tag: 1.7.0~14^2 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=b0982928d8ad3fa9fa67d802dd2cf21ec4e888b5;p=puppet-modules%2Fpuppetlabs-firewall.git Only catch changes if not EL5 due to selinux warning issue. --- diff --git a/spec/acceptance/class_spec.rb b/spec/acceptance/class_spec.rb index 4a9751a..0c74f97 100644 --- a/spec/acceptance/class_spec.rb +++ b/spec/acceptance/class_spec.rb @@ -6,7 +6,9 @@ describe "firewall class:", :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfa # Run it twice and test for idempotency apply_manifest(pp, :catch_failures => true) - expect(apply_manifest(pp, :catch_failures => true).exit_code).to be_zero + if do_catch_changes + expect(apply_manifest(pp, :catch_failures => true).exit_code).to be_zero + end end it 'ensure => stopped:' do @@ -14,7 +16,9 @@ describe "firewall class:", :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfa # Run it twice and test for idempotency apply_manifest(pp, :catch_failures => true) - expect(apply_manifest(pp, :catch_failures => true).exit_code).to be_zero + if do_catch_changes + expect(apply_manifest(pp, :catch_failures => true).exit_code).to be_zero + end end it 'ensure => running:' do @@ -22,6 +26,8 @@ describe "firewall class:", :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfa # Run it twice and test for idempotency apply_manifest(pp, :catch_failures => true) - expect(apply_manifest(pp, :catch_failures => true).exit_code).to be_zero + if do_catch_changes + expect(apply_manifest(pp, :catch_failures => true).exit_code).to be_zero + end end end diff --git a/spec/acceptance/firewall_bridging_spec.rb b/spec/acceptance/firewall_bridging_spec.rb index 96b013e..6b48f24 100644 --- a/spec/acceptance/firewall_bridging_spec.rb +++ b/spec/acceptance/firewall_bridging_spec.rb @@ -26,7 +26,7 @@ describe 'firewall type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfami EOS apply_manifest(pp, :catch_failures => true) - apply_manifest(pp, :catch_changes => true) + apply_manifest(pp, :catch_changes => do_catch_changes) end it 'should contain the rule' do @@ -50,7 +50,7 @@ describe 'firewall type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfami EOS apply_manifest(pp, :catch_failures => true) - apply_manifest(pp, :catch_changes => true) + apply_manifest(pp, :catch_changes => do_catch_changes) end it 'should contain the rule' do @@ -75,7 +75,7 @@ describe 'firewall type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfami EOS apply_manifest(pp, :catch_failures => true) - apply_manifest(pp, :catch_changes => true) + apply_manifest(pp, :catch_changes => do_catch_changes) end it 'should contain the rule' do @@ -99,7 +99,7 @@ describe 'firewall type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfami EOS apply_manifest(pp, :catch_failures => true) - apply_manifest(pp, :catch_changes => true) + apply_manifest(pp, :catch_changes => do_catch_changes) end it 'should contain the rule' do @@ -124,7 +124,7 @@ describe 'firewall type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfami EOS apply_manifest(pp, :catch_failures => true) - apply_manifest(pp, :catch_changes => true) + apply_manifest(pp, :catch_changes => do_catch_changes) end it 'should contain the rule' do @@ -149,7 +149,7 @@ describe 'firewall type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfami EOS apply_manifest(pp, :catch_failures => true) - apply_manifest(pp, :catch_changes => true) + apply_manifest(pp, :catch_changes => do_catch_changes) end it 'should contain the rule' do @@ -175,7 +175,7 @@ describe 'firewall type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfami EOS apply_manifest(pp, :catch_failures => true) - apply_manifest(pp, :catch_changes => true) + apply_manifest(pp, :catch_changes => do_catch_changes) end it 'should contain the rule' do @@ -205,7 +205,7 @@ describe 'firewall type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfami EOS apply_manifest(pp, :catch_failures => true) - apply_manifest(pp, :catch_changes => true) + apply_manifest(pp, :catch_changes => do_catch_changes) end it 'should contain the rule' do @@ -230,7 +230,7 @@ describe 'firewall type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfami EOS apply_manifest(pp, :catch_failures => true) - apply_manifest(pp, :catch_changes => true) + apply_manifest(pp, :catch_changes => do_catch_changes) end it 'should contain the rule' do @@ -256,7 +256,7 @@ describe 'firewall type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfami EOS apply_manifest(pp, :catch_failures => true) - apply_manifest(pp, :catch_changes => true) + apply_manifest(pp, :catch_changes => do_catch_changes) end it 'should contain the rule' do @@ -281,7 +281,7 @@ describe 'firewall type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfami EOS apply_manifest(pp, :catch_failures => true) - apply_manifest(pp, :catch_changes => true) + apply_manifest(pp, :catch_changes => do_catch_changes) end it 'should contain the rule' do @@ -307,7 +307,7 @@ describe 'firewall type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfami EOS apply_manifest(pp, :catch_failures => true) - apply_manifest(pp, :catch_changes => true) + apply_manifest(pp, :catch_changes => do_catch_changes) end it 'should contain the rule' do @@ -333,7 +333,7 @@ describe 'firewall type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfami EOS apply_manifest(pp, :catch_failures => true) - apply_manifest(pp, :catch_changes => true) + apply_manifest(pp, :catch_changes => do_catch_changes) end it 'should contain the rule' do @@ -360,7 +360,7 @@ describe 'firewall type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfami EOS apply_manifest(pp, :catch_failures => true) - apply_manifest(pp, :catch_changes => true) + apply_manifest(pp, :catch_changes => do_catch_changes) end it 'should contain the rule' do diff --git a/spec/acceptance/firewall_iptmodules_spec.rb b/spec/acceptance/firewall_iptmodules_spec.rb index 6023ff9..be0c5db 100644 --- a/spec/acceptance/firewall_iptmodules_spec.rb +++ b/spec/acceptance/firewall_iptmodules_spec.rb @@ -34,7 +34,7 @@ describe 'firewall type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfami EOS apply_manifest(pp, :catch_failures => true) - apply_manifest(pp, :catch_changes => true) + apply_manifest(pp, :catch_changes => do_catch_changes) end it 'should contain the rule' do @@ -62,7 +62,7 @@ describe 'firewall type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfami EOS apply_manifest(pp, :catch_failures => true) - apply_manifest(pp, :catch_changes => true) + apply_manifest(pp, :catch_changes => do_catch_changes) end it 'should contain the rule' do @@ -99,7 +99,7 @@ describe 'firewall type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfami EOS apply_manifest(pp, :catch_failures => true) - apply_manifest(pp, :catch_changes => true) + apply_manifest(pp, :catch_changes => do_catch_changes) end it 'should contain the rule' do @@ -128,7 +128,7 @@ describe 'firewall type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfami EOS apply_manifest(pp, :catch_failures => true) - apply_manifest(pp, :catch_changes => true) + apply_manifest(pp, :catch_changes => do_catch_changes) end it 'should contain the rule' do @@ -163,7 +163,7 @@ describe 'firewall type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfami EOS apply_manifest(pp, :catch_failures => true) - apply_manifest(pp, :catch_changes => true) + apply_manifest(pp, :catch_changes => do_catch_changes) end it 'should contain the rule' do @@ -191,7 +191,7 @@ describe 'firewall type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfami EOS apply_manifest(pp, :catch_failures => true) - apply_manifest(pp, :catch_changes => true) + apply_manifest(pp, :catch_changes => do_catch_changes) end it 'should contain the rule' do diff --git a/spec/acceptance/firewall_spec.rb b/spec/acceptance/firewall_spec.rb index 8576ffb..f131cfb 100644 --- a/spec/acceptance/firewall_spec.rb +++ b/spec/acceptance/firewall_spec.rb @@ -116,7 +116,7 @@ describe 'firewall type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfami EOS apply_manifest(pp, :catch_failures => true) - apply_manifest(pp, :catch_changes => true) + apply_manifest(pp, :catch_changes => do_catch_changes) end it 'should contain the rule' do @@ -139,7 +139,7 @@ describe 'firewall type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfami EOS apply_manifest(pp, :catch_failures => true) - apply_manifest(pp, :catch_changes => true) + apply_manifest(pp, :catch_changes => do_catch_changes) end it 'should contain the rule' do @@ -189,7 +189,7 @@ describe 'firewall type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfami EOS apply_manifest(pp, :catch_failures => true) - apply_manifest(pp, :catch_changes => true) + apply_manifest(pp, :catch_changes => do_catch_changes) end it 'should contain the rule' do @@ -239,7 +239,7 @@ describe 'firewall type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfami EOS apply_manifest(pp, :catch_failures => true) - apply_manifest(pp, :catch_changes => true) + apply_manifest(pp, :catch_changes => do_catch_changes) end it 'should contain the rule' do @@ -262,7 +262,7 @@ describe 'firewall type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfami EOS apply_manifest(pp, :catch_failures => true) - apply_manifest(pp, :catch_changes => true) + apply_manifest(pp, :catch_changes => do_catch_changes) end it 'should contain the rule' do @@ -312,7 +312,7 @@ describe 'firewall type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfami EOS apply_manifest(pp, :catch_failures => true) - apply_manifest(pp, :catch_changes => true) + apply_manifest(pp, :catch_changes => do_catch_changes) end it 'should contain the rule' do @@ -584,7 +584,7 @@ describe 'firewall type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfami EOS apply_manifest(pp, :catch_failures => true) - apply_manifest(pp, :catch_changes => true) + apply_manifest(pp, :catch_changes => do_catch_changes) end it 'should contain the rule' do @@ -920,7 +920,7 @@ describe 'firewall type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfami EOS apply_manifest(pp, :catch_failures => true) - apply_manifest(pp, :catch_changes => true) + apply_manifest(pp, :catch_changes => do_catch_changes) end it 'should contain the rule' do @@ -1199,7 +1199,7 @@ describe 'firewall type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfami EOS apply_manifest(pp, :catch_failures => true) - apply_manifest(pp, :catch_changes => true) + apply_manifest(pp, :catch_changes => do_catch_changes) end it 'should contain the rule' do @@ -1251,7 +1251,7 @@ describe 'firewall type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfami EOS apply_manifest(pp, :catch_failures => true) - apply_manifest(pp, :catch_changes => true) + apply_manifest(pp, :catch_changes => do_catch_changes) end it 'should contain the rule' do @@ -1609,7 +1609,7 @@ describe 'firewall type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfami EOS apply_manifest(pp, :catch_failures => true) - apply_manifest(pp, :catch_changes => true) + apply_manifest(pp, :catch_changes => do_catch_changes) end it 'should contain the rule' do @@ -1632,7 +1632,7 @@ describe 'firewall type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfami EOS apply_manifest(pp, :catch_failures => true) - apply_manifest(pp, :catch_changes => true) + apply_manifest(pp, :catch_changes => do_catch_changes) end it 'should contain the rule' do diff --git a/spec/acceptance/firewall_time_spec.rb b/spec/acceptance/firewall_time_spec.rb index 61365bb..e6ea34e 100644 --- a/spec/acceptance/firewall_time_spec.rb +++ b/spec/acceptance/firewall_time_spec.rb @@ -30,7 +30,7 @@ describe 'firewall type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfami EOS apply_manifest(pp, :catch_failures => true) - apply_manifest(pp, :catch_changes => true) + apply_manifest(pp, :catch_changes => do_catch_changes) end it 'should contain the rule' do @@ -63,7 +63,7 @@ describe 'firewall type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfami EOS apply_manifest(pp, :catch_failures => true) - apply_manifest(pp, :catch_changes => true) + apply_manifest(pp, :catch_changes => do_catch_changes) end it 'should contain the rule' do diff --git a/spec/acceptance/firewall_uid_spec.rb b/spec/acceptance/firewall_uid_spec.rb index 3a976f9..ce45333 100644 --- a/spec/acceptance/firewall_uid_spec.rb +++ b/spec/acceptance/firewall_uid_spec.rb @@ -25,7 +25,7 @@ describe 'firewall type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfami EOS apply_manifest(pp, :catch_failures => true) - apply_manifest(pp, :catch_changes => true) + apply_manifest(pp, :catch_changes => do_catch_changes) end it 'should contain the rule' do @@ -48,7 +48,7 @@ describe 'firewall type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfami EOS apply_manifest(pp, :catch_failures => true) - apply_manifest(pp, :catch_changes => true) + apply_manifest(pp, :catch_changes => do_catch_changes) end it 'should contain the rule' do @@ -71,7 +71,7 @@ describe 'firewall type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfami EOS apply_manifest(pp, :catch_failures => true) - apply_manifest(pp, :catch_changes => true) + apply_manifest(pp, :catch_changes => do_catch_changes) end it 'should contain the rule' do @@ -94,7 +94,7 @@ describe 'firewall type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfami EOS apply_manifest(pp, :catch_failures => true) - apply_manifest(pp, :catch_changes => true) + apply_manifest(pp, :catch_changes => do_catch_changes) end it 'should contain the rule' do diff --git a/spec/acceptance/firewallchain_spec.rb b/spec/acceptance/firewallchain_spec.rb index f70d9ce..eaf71cc 100644 --- a/spec/acceptance/firewallchain_spec.rb +++ b/spec/acceptance/firewallchain_spec.rb @@ -14,7 +14,7 @@ describe 'puppet resource firewallchain command:', :unless => UNSUPPORTED_PLATFO EOS # Run it twice and test for idempotency apply_manifest(pp, :catch_failures => true) - apply_manifest(pp, :catch_changes => true) + apply_manifest(pp, :catch_changes => do_catch_changes) end it 'finds the chain' do @@ -33,7 +33,7 @@ describe 'puppet resource firewallchain command:', :unless => UNSUPPORTED_PLATFO EOS # Run it twice and test for idempotency apply_manifest(pp, :catch_failures => true) - apply_manifest(pp, :catch_changes => true) + apply_manifest(pp, :catch_changes => do_catch_changes) end it 'fails to find the chain' do @@ -60,7 +60,7 @@ describe 'puppet resource firewallchain command:', :unless => UNSUPPORTED_PLATFO # EOS # # Run it twice and test for idempotency # apply_manifest(pp, :catch_failures => true) - # apply_manifest(pp, :catch_changes => true) + # apply_manifest(pp, :catch_changes => do_catch_changes) # end #end @@ -81,7 +81,7 @@ describe 'puppet resource firewallchain command:', :unless => UNSUPPORTED_PLATFO # expect(r.stdout).to_not match(/removed/) # expect(r.stderr).to eq('') # end - # apply_manifest(pp, :catch_changes => true) + # apply_manifest(pp, :catch_changes => do_catch_changes) # end # it 'still has the rule' do @@ -94,7 +94,7 @@ describe 'puppet resource firewallchain command:', :unless => UNSUPPORTED_PLATFO # } # EOS # # Run it twice and test for idempotency - # apply_manifest(pp, :catch_changes => true) + # apply_manifest(pp, :catch_changes => do_catch_changes) # end #end @@ -112,7 +112,7 @@ describe 'puppet resource firewallchain command:', :unless => UNSUPPORTED_PLATFO EOS # Run it twice and test for idempotency apply_manifest(pp, :catch_failures => true) - apply_manifest(pp, :catch_changes => true) + apply_manifest(pp, :catch_changes => do_catch_changes) end it 'finds the chain' do diff --git a/spec/acceptance/invert_spec.rb b/spec/acceptance/invert_spec.rb index ade319f..f8ce25e 100644 --- a/spec/acceptance/invert_spec.rb +++ b/spec/acceptance/invert_spec.rb @@ -25,7 +25,7 @@ describe 'firewall type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfami EOS apply_manifest(pp, :catch_failures => true) - apply_manifest(pp, :catch_changes => true) + apply_manifest(pp, :catch_changes => do_catch_changes) end it 'should contain the rules' do diff --git a/spec/acceptance/ip6_fragment_spec.rb b/spec/acceptance/ip6_fragment_spec.rb index 3e44f87..86c2858 100644 --- a/spec/acceptance/ip6_fragment_spec.rb +++ b/spec/acceptance/ip6_fragment_spec.rb @@ -37,7 +37,7 @@ else EOS apply_manifest(pp, :catch_failures => true) - apply_manifest(pp, :catch_changes => true) + apply_manifest(pp, :catch_changes => do_catch_changes) shell('ip6tables-save') do |r| expect(r.stdout).to match(/#{line_match}/) @@ -56,7 +56,7 @@ else } EOS - apply_manifest(pp, :catch_changes => true) + apply_manifest(pp, :catch_changes => do_catch_changes) shell('ip6tables-save') do |r| expect(r.stdout).to match(/#{line_match}/) diff --git a/spec/acceptance/isfragment_spec.rb b/spec/acceptance/isfragment_spec.rb index a4b65e7..f48f272 100644 --- a/spec/acceptance/isfragment_spec.rb +++ b/spec/acceptance/isfragment_spec.rb @@ -17,7 +17,7 @@ describe 'firewall isfragment property', :unless => UNSUPPORTED_PLATFORMS.includ EOS apply_manifest(pp, :catch_failures => true) - apply_manifest(pp, :catch_changes => true) + apply_manifest(pp, :catch_changes => do_catch_changes) shell('iptables-save') do |r| expect(r.stdout).to match(/#{line_match}/) @@ -35,7 +35,7 @@ describe 'firewall isfragment property', :unless => UNSUPPORTED_PLATFORMS.includ } EOS - apply_manifest(pp, :catch_changes => true) + apply_manifest(pp, :catch_changes => do_catch_changes) shell('iptables-save') do |r| expect(r.stdout).to match(/#{line_match}/) diff --git a/spec/acceptance/purge_spec.rb b/spec/acceptance/purge_spec.rb index ab37b2c..2d87220 100644 --- a/spec/acceptance/purge_spec.rb +++ b/spec/acceptance/purge_spec.rb @@ -71,7 +71,7 @@ describe "purge tests:", :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamil } EOS - apply_manifest(pp, :catch_changes => true) + apply_manifest(pp, :catch_changes => do_catch_changes) end it 'ignores specified rules' do @@ -85,7 +85,7 @@ describe "purge tests:", :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamil } EOS - apply_manifest(pp, :catch_changes => true) + apply_manifest(pp, :catch_changes => do_catch_changes) end it 'adds managed rules with ignored rules' do @@ -167,7 +167,7 @@ describe "purge tests:", :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamil } EOS - apply_manifest(pp, :catch_changes => true) + apply_manifest(pp, :catch_changes => do_catch_changes) end it 'ignores specified rules' do @@ -181,7 +181,7 @@ describe "purge tests:", :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamil } EOS - apply_manifest(pp, :catch_changes => true) + apply_manifest(pp, :catch_changes => do_catch_changes) end it 'adds managed rules with ignored rules' do diff --git a/spec/acceptance/rules_spec.rb b/spec/acceptance/rules_spec.rb index b91e11e..153762a 100644 --- a/spec/acceptance/rules_spec.rb +++ b/spec/acceptance/rules_spec.rb @@ -242,7 +242,7 @@ describe 'complex ruleset 2' do # Run it twice and test for idempotency apply_manifest(pp, :catch_failures => true) - apply_manifest(pp, :catch_changes => true) + apply_manifest(pp, :catch_changes => do_catch_changes) end it 'contains appropriate rules' do diff --git a/spec/acceptance/standard_usage_spec.rb b/spec/acceptance/standard_usage_spec.rb index e585bb7..afc0c42 100644 --- a/spec/acceptance/standard_usage_spec.rb +++ b/spec/acceptance/standard_usage_spec.rb @@ -55,6 +55,6 @@ describe 'standard usage tests:', :unless => UNSUPPORTED_PLATFORMS.include?(fact # Run it twice and test for idempotency apply_manifest(pp, :catch_failures => true) - apply_manifest(pp, :catch_changes => true) + apply_manifest(pp, :catch_changes => do_catch_changes) end end diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 383e34b..44b5f8d 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -13,6 +13,14 @@ def ip6tables_flush_all_tables end end +def do_catch_changes + if default['platform'] =~ /el-5/ + return false + else + return true + end +end + run_puppet_install_helper UNSUPPORTED_PLATFORMS = ['windows','Solaris','Darwin']