Updating header_checks_snippet to use concat

This commit is contained in:
Silvio Rhatto 2013-01-21 19:08:06 -02:00
parent 7cc8c05c57
commit 56bac37c33

View file

@ -15,7 +15,7 @@ Example usage:
node "toto.example.com" { node "toto.example.com" {
include postfix include postfix
postfix::header_checks { postfix::header_checks_snippet {
'wrong_date': content => 'FIXME'; 'wrong_date': content => 'FIXME';
'bla': source => 'puppet:///files/etc/postfix/header_checks.d/bla'; 'bla': source => 'puppet:///files/etc/postfix/header_checks.d/bla';
} }
@ -37,29 +37,22 @@ define postfix::header_checks_snippet (
fail("Only one of \$source or \$content must specified for postfix::header_checks_snippet ${name}") fail("Only one of \$source or \$content must specified for postfix::header_checks_snippet ${name}")
} }
if ($value == false) and ($ensure == "present") {
fail("The value parameter must be set when using the postfix::header_checks_snippet define with ensure=present.")
}
include postfix::header_checks include postfix::header_checks
$snippetfile = "${postfix::header_checks::postfix_header_checks_snippets_dir}/${name}" $fragment = "postfix_header_checks_${name}"
file { "$snippetfile": concat::fragment { "$fragment":
ensure => "$ensure", ensure => "$ensure",
mode => 600, target => '/etc/postfix/header_checks',
owner => root,
group => 0,
notify => Exec["concat_${postfix::header_checks::postfix_merged_header_checks}"],
} }
if $source { if $source {
File["$snippetfile"] { Concat::Fragment["$fragment"] {
source => $source, source => $source,
} }
} }
else { else {
File["$snippetfile"] { Concat::Fragment["$fragment"] {
content => $content, content => $content,
} }
} }