forked from redhat-openstack/openstack-puppet-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MODULES-1309 - Make package and service names configurable
This was motivated by a need to make this work on Debian Jessie.
- Loading branch information
Morgan Haskel
committed
Dec 3, 2014
1 parent
b0daa9d
commit f9a2db9
Showing
10 changed files
with
208 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
class firewall::params { | ||
case $::osfamily { | ||
'RedHat': { | ||
case $::operatingsystem { | ||
'Archlinux': { | ||
$service_name = ['iptables','ip6tables'] | ||
$package_name = undef | ||
} | ||
'Fedora': { | ||
if versioncmp($::operatingsystemrelease, '15') >= 0 { | ||
$package_name = 'iptables-services' | ||
} else { | ||
$package_name = undef | ||
} | ||
$service_name = 'iptables' | ||
} | ||
default: { | ||
if versioncmp($::operatingsystemrelease, '7.0') >= 0 { | ||
$package_name = 'iptables-services' | ||
} else { | ||
$package_name = undef | ||
} | ||
$service_name = 'iptables' | ||
} | ||
} | ||
} | ||
'Debian': { | ||
if $::operatingsystemrelease =~ /^6\./ and versioncmp($::iptables_persistent_version, '0.5.0') < 0 { | ||
$service_name = undef | ||
$package_name = 'iptables-persistent' | ||
} elsif $::operatingsystem == 'Debian' and versioncmp($::operatingsystemrelease, '8.0') >= 0 { | ||
$service_name = 'netfilter-persistent' | ||
$package_name = 'netfilter-persistent' | ||
} else { | ||
$service_name = 'iptables-persistent' | ||
$package_name = 'iptables-persistent' | ||
} | ||
} | ||
default: { | ||
$package_name = undef | ||
$service_name = 'iptables' | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,87 @@ | ||
require 'spec_helper' | ||
|
||
describe 'firewall::linux::debian', :type => :class do | ||
it { should contain_package('iptables-persistent').with( | ||
:ensure => 'present' | ||
)} | ||
it { should contain_service('iptables-persistent').with( | ||
:ensure => nil, | ||
:enable => 'true', | ||
:require => 'Package[iptables-persistent]' | ||
)} | ||
context "Debian 7" do | ||
let(:facts) {{ | ||
:osfamily => 'Debian', | ||
:operatingsystem => 'Debian', | ||
:operatingsystemrelease => '7.0' | ||
}} | ||
it { should contain_package('iptables-persistent').with( | ||
:ensure => 'present' | ||
)} | ||
it { should contain_service('iptables-persistent').with( | ||
:ensure => nil, | ||
:enable => 'true', | ||
:require => 'Package[iptables-persistent]' | ||
)} | ||
end | ||
|
||
context 'enable => false' do | ||
context 'deb7 enable => false' do | ||
let(:facts) {{ | ||
:osfamily => 'Debian', | ||
:operatingsystem => 'Debian', | ||
:operatingsystemrelease => '7.0' | ||
}} | ||
let(:params) {{ :enable => 'false' }} | ||
it { should contain_service('iptables-persistent').with( | ||
:enable => 'false' | ||
)} | ||
end | ||
|
||
context "Debian 8" do | ||
let(:facts) {{ | ||
:osfamily => 'Debian', | ||
:operatingsystem => 'Debian', | ||
:operatingsystemrelease => 'jessie/sid' | ||
}} | ||
it { should contain_package('netfilter-persistent').with( | ||
:ensure => 'present' | ||
)} | ||
it { should contain_service('netfilter-persistent').with( | ||
:ensure => nil, | ||
:enable => 'true', | ||
:require => 'Package[netfilter-persistent]' | ||
)} | ||
end | ||
|
||
context 'deb8 enable => false' do | ||
let(:facts) {{ | ||
:osfamily => 'Debian', | ||
:operatingsystem => 'Debian', | ||
:operatingsystemrelease => 'jessie/sid' | ||
}} | ||
let(:params) {{ :enable => 'false' }} | ||
it { should contain_service('netfilter-persistent').with( | ||
:enable => 'false' | ||
)} | ||
end | ||
|
||
context "Debian 8, alt operatingsystem" do | ||
let(:facts) {{ | ||
:osfamily => 'Debian', | ||
:operatingsystem => 'Debian', | ||
:operatingsystemrelease => '8.0' | ||
}} | ||
it { should contain_package('netfilter-persistent').with( | ||
:ensure => 'present' | ||
)} | ||
it { should contain_service('netfilter-persistent').with( | ||
:ensure => nil, | ||
:enable => 'true', | ||
:require => 'Package[netfilter-persistent]' | ||
)} | ||
end | ||
|
||
context 'deb8, alt operatingsystem, enable => false' do | ||
let(:facts) {{ | ||
:osfamily => 'Debian', | ||
:operatingsystem => 'Debian', | ||
:operatingsystemrelease => '8.0' | ||
}} | ||
let(:params) {{ :enable => 'false' }} | ||
it { should contain_service('netfilter-persistent').with( | ||
:enable => 'false' | ||
)} | ||
end | ||
end |
Oops, something went wrong.