-
Notifications
You must be signed in to change notification settings - Fork 29
fixes to ipset_sync #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
# installs startup files and scripts | ||
class ipset::install { | ||
include ipset::params | ||
|
||
$cfg = $::ipset::params::config_path | ||
|
||
# main package | ||
package { $::ipset::params::package: | ||
alias => 'ipset', | ||
ensure => installed, | ||
alias => 'ipset', | ||
} | ||
|
||
# directory with config profiles (*.set & *.hdr files) | ||
|
@@ -18,29 +19,38 @@ | |
ipset::install::helper_script { ['ipset_sync', 'ipset_init']: } | ||
|
||
# autostart | ||
if $::osfamily == 'RedHat' and $::operatingsystemmajrelease == '6' { | ||
# upstart starter | ||
file { '/etc/init/ipset.conf': | ||
owner => 'root', | ||
group => 'root', | ||
mode => '0644', | ||
content => template("${module_name}/init.upstart.erb"), | ||
} | ||
} else { | ||
if $::osfamily == 'RedHat' and $::operatingsystemmajrelease == '7' { | ||
# systemd | ||
file { '/usr/lib/systemd/system/ipset.service': | ||
owner => 'root', | ||
group => 'root', | ||
mode => '0644', | ||
content => template("${module_name}/systemd.service.erb"), | ||
case $::osfamily { | ||
'RedHat', 'redhat': { | ||
case $::operatingsystemrelease { | ||
/^6.*/: { # upstart starter | ||
file { '/etc/init/ipset.conf': | ||
owner => 'root', | ||
group => 'root', | ||
mode => '0644', | ||
content => template("${module_name}/init.upstart.erb"), | ||
} | ||
} | ||
/^7.*/: { # systemd | ||
file { '/usr/lib/systemd/system/ipset.service': | ||
owner => 'root', | ||
group => 'root', | ||
mode => '0644', | ||
content => template("${module_name}/systemd.service.erb"), | ||
} | ||
file { '/etc/systemd/system/basic.target.wants/ipset.service': | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know this isn't your addition, but wouldn't it be better to just run |
||
ensure => link, | ||
target => '/usr/lib/systemd/system/ipset.service', | ||
} | ||
} | ||
default: { fail("Unsupported RedHat family version is ${$::operatingsystemrelease} - autostart not enabled") } | ||
} | ||
file { '/etc/systemd/system/basic.target.wants/ipset.service': | ||
ensure => link, | ||
target => '/usr/lib/systemd/system/ipset.service', | ||
} | ||
} else { | ||
warning('Autostart of ipset not implemented for this OS.') | ||
} | ||
'': { # handle bug in our Jenkins that returns empty strings for all of these when verifying | ||
if "${$::osfamily}${$::operatingsystem}${$::operatingsystemmajrelease}" == '' { | ||
warning("Got null for OS Family, assuming I'm running in Jenkins and this is a known bug!") } | ||
else { fail( "Unsupported OSFamily \"${$::osfamily}\" OS is \"${$::operatingsystem}\" major version is \"${$::operatingsystemmajrelease}\" ") } | ||
} | ||
default: { fail( "Unsupported OSFamily \"${$::osfamily}\" OS is \"${$::operatingsystem}\" major version is \"${$::operatingsystemmajrelease}\" ") } | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
require 'spec_helper' | ||
|
||
describe 'ipset' do | ||
it do | ||
should contain_package('ipset') | ||
end | ||
it 'drops ipset_init' do | ||
should contain_file('/usr/local/sbin/ipset_init') | ||
end | ||
it 'drops ipset_sync' do | ||
should contain_file('/usr/local/sbin/ipset_sync') | ||
end | ||
it 'drops ipset.conf' do | ||
should contain_file('/etc/init/ipset.conf') | ||
end | ||
|
||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
require 'spec_helper' | ||
|
||
describe 'ipset' do | ||
let(:title){ 'ipset' } | ||
let(:params){{ :set => "myipset" }} | ||
it do | ||
should contain_package('ipset') | ||
should contain_file("/usr/local/sbin/ipset_init"). | ||
with_mode('0754').with_owner('root').with_group('root'). | ||
with_source("puppet:///modules/ipset/ipset_init") | ||
should contain_file("/usr/local/sbin/ipset_sync"). | ||
with_mode('0754').with_owner('root').with_group('root'). | ||
with_source("puppet:///modules/ipset/ipset_sync") | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../files |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../manifests |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../templates |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../.rspec-puppet/spec.opts |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../.rspec-puppet/spec_helper.rb |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I recall correctly, case's in puppet against strings are case insensitive.