diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2011-07-13 22:30:12 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2011-07-13 22:30:12 -0300 |
commit | e70609a148ec092bc35dda0698deaa619eb1a67d (patch) | |
tree | b2a14b50a5a94e8cf2337910a4eff48ba6c350be /manifests/definitions | |
parent | c904fc86c52f335fe2fe4d93bba3dd59705b10fd (diff) | |
parent | 1f99fcdfdbe73be25c7a5ea80853bbc4618d4f76 (diff) | |
download | puppet-postfix-e70609a148ec092bc35dda0698deaa619eb1a67d.tar.gz puppet-postfix-e70609a148ec092bc35dda0698deaa619eb1a67d.tar.bz2 |
Merge branch 'master' of git://gaffer.ptitcanardnoir.org/puppet-module-postfix
Diffstat (limited to 'manifests/definitions')
-rw-r--r-- | manifests/definitions/header_checks_snippet.pp | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/manifests/definitions/header_checks_snippet.pp b/manifests/definitions/header_checks_snippet.pp new file mode 100644 index 0000000..454d219 --- /dev/null +++ b/manifests/definitions/header_checks_snippet.pp @@ -0,0 +1,67 @@ +/* +== Definition: postfix::header_checks_snippet + +Adds a header_checks snippets to /etc/postfix/header_checks. +See the postfix::header_checks class for details. + +Parameters: +- *source* or *content*: source or content of the header_checks snippet +- *ensure*: present (default) or absent + +Requires: +- Class["postfix"] + +Example usage: + + node "toto.example.com" { + include postfix + postfix::header_checks { + 'wrong_date': content => 'FIXME'; + 'bla': source => 'puppet:///files/etc/postfix/header_checks.d/bla'; + } + } + +*/ + +define postfix::header_checks_snippet ( + $ensure = "present", + $source = '', + $content = undef +) { + + if $source == '' and $content == undef { + fail("One of \$source or \$content must be specified for postfix::header_checks_snippet ${name}") + } + + if $source != '' and $content != undef { + 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 + + $snippetfile = "${postfix::header_checks::postfix_header_checks_snippets_dir}/${name}" + + file { "$snippetfile": + ensure => "$ensure", + mode => 600, + owner => root, + group => 0, + notify => Exec["concat_${postfix::header_checks::postfix_merged_header_checks}"], + } + + if $source { + File["$snippetfile"] { + source => $source, + } + } + else { + File["$snippetfile"] { + content => $content, + } + } + +} |