[refactor] Dont use case statement in resource def
This commit is contained in:
parent
1eea47c2f6
commit
f4201357e5
1 changed files with 14 additions and 8 deletions
|
@ -56,10 +56,12 @@ class postfix(
|
||||||
$default_alias_maps = true
|
$default_alias_maps = true
|
||||||
) {
|
) {
|
||||||
|
|
||||||
# selinux labels differ from one distribution to another
|
|
||||||
case $::operatingsystem {
|
case $::operatingsystem {
|
||||||
|
|
||||||
RedHat, CentOS: {
|
RedHat, CentOS: {
|
||||||
|
$master_cf_template = 'postfix/master.cf.redhat5.erb'
|
||||||
|
|
||||||
|
# selinux labels differ from one distribution to another
|
||||||
case $::operatingsystemmajrelease {
|
case $::operatingsystemmajrelease {
|
||||||
'4': { $postfix_seltype = 'etc_t' }
|
'4': { $postfix_seltype = 'etc_t' }
|
||||||
'5': { $postfix_seltype = 'postfix_etc_t' }
|
'5': { $postfix_seltype = 'postfix_etc_t' }
|
||||||
|
@ -67,8 +69,17 @@ class postfix(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
'Debian': {
|
||||||
|
$master_cf_template = "postfix/master.cf.debian-${::operatingsystemmajrelease}.erb"
|
||||||
|
}
|
||||||
|
|
||||||
|
'Ubuntu': {
|
||||||
|
$master_cf_template = 'postfix/master.cf.debian-sid.erb'
|
||||||
|
}
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
$postfix_seltype = undef
|
$postfix_seltype = undef
|
||||||
|
$master_cf_template = undef
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,12 +153,7 @@ class postfix(
|
||||||
owner => 'root',
|
owner => 'root',
|
||||||
group => 'root',
|
group => 'root',
|
||||||
mode => '0644',
|
mode => '0644',
|
||||||
content => $::operatingsystem ? {
|
content => template($master_cf_template),
|
||||||
Redhat => template('postfix/master.cf.redhat5.erb'),
|
|
||||||
CentOS => template('postfix/master.cf.redhat5.erb'),
|
|
||||||
Debian => template("postfix/master.cf.debian-${::operatingsystemmajrelease}.erb"),
|
|
||||||
Ubuntu => template('postfix/master.cf.debian-etch.erb'),
|
|
||||||
},
|
|
||||||
seltype => $postfix_seltype,
|
seltype => $postfix_seltype,
|
||||||
notify => Service['postfix'],
|
notify => Service['postfix'],
|
||||||
require => Package['postfix'],
|
require => Package['postfix'],
|
||||||
|
|
Loading…
Reference in a new issue