Skip to content

Commit

Permalink
Merge pull request #416 from mhaskel/selinux_fixes
Browse files Browse the repository at this point in the history
Don't do the idempotency checks with selinux
  • Loading branch information
hunner committed Oct 16, 2014
2 parents 903a3a0 + 244f3f6 commit de7d781
Show file tree
Hide file tree
Showing 9 changed files with 71 additions and 21 deletions.
28 changes: 21 additions & 7 deletions spec/acceptance/firewall_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ class { '::firewall': }
EOS

apply_manifest(pp, :catch_failures => true)
apply_manifest(pp, :catch_changes => true)
unless fact('selinux') == 'true'
apply_manifest(pp, :catch_changes => true)
end
end

it 'should contain the rule' do
Expand All @@ -139,7 +141,9 @@ class { '::firewall': }
EOS

apply_manifest(pp, :catch_failures => true)
apply_manifest(pp, :catch_changes => true)
unless fact('selinux') == 'true'
apply_manifest(pp, :catch_changes => true)
end
end

it 'should contain the rule' do
Expand Down Expand Up @@ -189,7 +193,9 @@ class { '::firewall': }
EOS

apply_manifest(pp, :catch_failures => true)
apply_manifest(pp, :catch_changes => true)
unless fact('selinux') == 'true'
apply_manifest(pp, :catch_changes => true)
end
end

it 'should contain the rule' do
Expand Down Expand Up @@ -239,7 +245,9 @@ class { '::firewall': }
EOS

apply_manifest(pp, :catch_failures => true)
apply_manifest(pp, :catch_changes => true)
unless fact('selinux') == 'true'
apply_manifest(pp, :catch_changes => true)
end
end

it 'should contain the rule' do
Expand All @@ -262,7 +270,9 @@ class { '::firewall': }
EOS

apply_manifest(pp, :catch_failures => true)
apply_manifest(pp, :catch_changes => true)
unless fact('selinux') == 'true'
apply_manifest(pp, :catch_changes => true)
end
end

it 'should contain the rule' do
Expand Down Expand Up @@ -312,7 +322,9 @@ class { '::firewall': }
EOS

apply_manifest(pp, :catch_failures => true)
apply_manifest(pp, :catch_changes => true)
unless fact('selinux') == 'true'
apply_manifest(pp, :catch_changes => true)
end
end

it 'should contain the rule' do
Expand Down Expand Up @@ -839,7 +851,9 @@ class { '::firewall': }
EOS

apply_manifest(pp, :catch_failures => true)
apply_manifest(pp, :catch_changes => true)
unless fact('selinux') == 'true'
apply_manifest(pp, :catch_changes => true)
end
end

it 'should contain the rule' do
Expand Down
12 changes: 9 additions & 3 deletions spec/acceptance/firewallchain_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
EOS
# Run it twice and test for idempotency
apply_manifest(pp, :catch_failures => true)
apply_manifest(pp, :catch_changes => true)
unless fact('selinux') == 'true'
apply_manifest(pp, :catch_changes => true)
end
end

it 'finds the chain' do
Expand All @@ -33,7 +35,9 @@
EOS
# Run it twice and test for idempotency
apply_manifest(pp, :catch_failures => true)
apply_manifest(pp, :catch_changes => true)
unless fact('selinux') == 'true'
apply_manifest(pp, :catch_changes => true)
end
end

it 'fails to find the chain' do
Expand Down Expand Up @@ -112,7 +116,9 @@
EOS
# Run it twice and test for idempotency
apply_manifest(pp, :catch_failures => true)
apply_manifest(pp, :catch_changes => true)
unless fact('selinux') == 'true'
apply_manifest(pp, :catch_changes => true)
end
end

it 'finds the chain' do
Expand Down
4 changes: 3 additions & 1 deletion spec/acceptance/invert_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ class { '::firewall': }
EOS

apply_manifest(pp, :catch_failures => true)
apply_manifest(pp, :catch_changes => true)
unless fact('selinux') == 'true'
apply_manifest(pp, :catch_changes => true)
end
end

it 'should contain the rules' do
Expand Down
10 changes: 8 additions & 2 deletions spec/acceptance/ip6_fragment_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ class { '::firewall': }
EOS

apply_manifest(pp, :catch_failures => true)
apply_manifest(pp, :catch_changes => true)
unless fact('selinux') == 'true'
apply_manifest(pp, :catch_changes => true)
end

shell('ip6tables-save') do |r|
expect(r.stdout).to match(/#{line_match}/)
Expand All @@ -56,7 +58,11 @@ class { '::firewall': }
}
EOS

apply_manifest(pp, :catch_changes => true)
if fact('selinux') == 'true'
apply_manifest(pp, :catch_failures => true)
else
apply_manifest(pp, :catch_changes => true)
end

shell('ip6tables-save') do |r|
expect(r.stdout).to match(/#{line_match}/)
Expand Down
10 changes: 8 additions & 2 deletions spec/acceptance/isfragment_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ class { '::firewall': }
EOS

apply_manifest(pp, :catch_failures => true)
apply_manifest(pp, :catch_changes => true)
unless fact('selinux') == 'true'
apply_manifest(pp, :catch_changes => true)
end

shell('iptables-save') do |r|
expect(r.stdout).to match(/#{line_match}/)
Expand All @@ -35,7 +37,11 @@ class { '::firewall': }
}
EOS

apply_manifest(pp, :catch_changes => true)
if fact('selinux') == 'true'
apply_manifest(pp, :catch_failures => true)
else
apply_manifest(pp, :catch_changes => true)
end

shell('iptables-save') do |r|
expect(r.stdout).to match(/#{line_match}/)
Expand Down
10 changes: 8 additions & 2 deletions spec/acceptance/purge_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ class { 'firewall': }
}
EOS

apply_manifest(pp, :catch_changes => true)
unless fact('selinux') == 'true'
apply_manifest(pp, :catch_changes => true)
end
end

it 'ignores specified rules' do
Expand All @@ -82,7 +84,11 @@ class { 'firewall': }
}
EOS

apply_manifest(pp, :catch_changes => true)
if fact('selinux') == 'true'
apply_manifest(pp, :catch_failures => true)
else
apply_manifest(pp, :catch_changes => true)
end
end

it 'adds managed rules with ignored rules' do
Expand Down
4 changes: 3 additions & 1 deletion spec/acceptance/rules_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,9 @@ class { '::firewall': }

# Run it twice and test for idempotency
apply_manifest(pp, :catch_failures => true)
apply_manifest(pp, :catch_changes => true)
unless fact('selinux') == 'true'
apply_manifest(pp, :catch_changes => true)
end
end

it 'contains appropriate rules' do
Expand Down
10 changes: 8 additions & 2 deletions spec/acceptance/socket_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ class { '::firewall': }
EOS

apply_manifest(pp, :catch_failures => true)
apply_manifest(pp, :catch_changes => true)
unless fact('selinux') == 'true'
apply_manifest(pp, :catch_changes => true)
end

shell('iptables-save -t raw') do |r|
expect(r.stdout).to match(/#{line_match}/)
Expand All @@ -40,7 +42,11 @@ class { '::firewall': }
}
EOS

apply_manifest(pp, :catch_changes => true)
if fact('selinux') == 'true'
apply_manifest(pp, :catch_failures => true)
else
apply_manifest(pp, :catch_changes => true)
end

shell('iptables-save -t raw') do |r|
expect(r.stdout).to match(/#{line_match}/)
Expand Down
4 changes: 3 additions & 1 deletion spec/acceptance/standard_usage_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ class { 'firewall': }

# 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
unless fact('selinux') == 'true'
apply_manifest(pp, :catch_changes => true)
end
end
end

0 comments on commit de7d781

Please sign in to comment.