fuel-library/deployment/puppet/cobbler/spec/classes/cobbler_checksum_bootpc_spec.rb
Alex Schultz fca6c1dc76 Update cobbler checksum firewall exec for centos7
This change removes the reference to the iptables init script which no
longer exists under CentOS7 and replaces it with a iptables-save that is
similar to the way it is done for Debian based systems.

Change-Id: Ib6a4b7a87c452e6397d0b708f3408c32c11bd01f
Closes-Bug: #1524828
2015-12-10 10:29:43 -07:00

55 lines
1.4 KiB
Ruby

require 'spec_helper'
describe 'cobbler::checksum_bootpc' do
let(:default_params) { {
} }
shared_examples_for 'cobbler::checksum_bootpc configuration' do
let :params do
default_params
end
context 'with default params' do
let :params do
default_params.merge!({})
end
it 'configures with the default params' do
if facts[:operatingsystem] == 'RedHat'
save_location = '/etc/sysconfig/iptables'
elsif facts[:operatingsystem] == 'Debian'
save_location = '/etc/iptables.rules'
end
should contain_exec('checksum_fill_bootpc').with(
:command => "iptables -t mangle -A POSTROUTING -p udp --dport 68 -j CHECKSUM --checksum-fill; iptables-save -c > #{save_location}",
:unless => 'iptables -t mangle -S POSTROUTING | grep -q "^-A POSTROUTING -p udp -m udp --dport 68 -j CHECKSUM --checksum-fill"'
)
end
end
end
context 'on Debian platforms' do
let :facts do
@default_facts.merge({ :osfamily => 'Debian',
:operatingsystem => 'Debian',
})
end
it_configures 'cobbler::checksum_bootpc configuration'
end
context 'on RedHat platforms' do
let :facts do
@default_facts.merge({ :osfamily => 'RedHat',
:operatingsystem => 'RedHat',
})
end
it_configures 'cobbler::checksum_bootpc configuration'
end
end