Skip to content
Snippets Groups Projects
Commit 74aaf446 authored by Russ Allbery's avatar Russ Allbery
Browse files

Reformat base::postfix::map and improve examples

Reindent for our current indentation standards, and fix the examples
to use the correct URLs with the /modules component.
parent c7d8e643
No related branches found
No related tags found
No related merge requests found
......@@ -2,14 +2,14 @@
# postmap or postalias as needed. Example for a map file:
#
# base::postfix::map { '/etc/postfix/access/smtp':
# source => 'puppet:///s_emailrouter/etc/postfix/access/smtp',
# source => 'puppet:///modules/s_emailrouter/etc/postfix/access/smtp',
# }
#
# Example for an aliases file, which has to use a different command:
#
# base::postfix::map { '/etc/postfix/aliases':
# command => 'postalias',
# source => 'puppet:///s_nagios/etc/postfix/aliases',
# command => 'postalias',
# source => 'puppet:///modules/s_nagios/etc/postfix/aliases',
# }
#
# Either source or content can be used with the map.
......@@ -21,45 +21,44 @@
# actually needs that.
define base::postfix::map(
$ensure = 'present',
$command = 'postmap',
$type = 'hash',
$content = undef,
$source = undef)
$ensure = 'present',
$command = 'postmap',
$type = 'hash',
$content = undef,
$source = undef)
{
if ($type != 'hash') and ($type != 'btree') {
crit "unknown Postfix map type $type"
}
if ($type != 'hash') and ($type != 'btree') {
crit "unknown Postfix map type $type"
}
file { $name:
ensure => $ensure,
content => $content,
source => $source,
notify => Exec["${command} ${type}:${name}"],
require => Package['postfix'],
}
file { $name:
ensure => $ensure,
content => $content,
source => $source,
notify => Exec["${command} ${type}:${name}"],
require => Package['postfix'],
}
# If ensure is absent, remove the detritus of our hash.
if ($ensure == 'absent') {
file { "${name}.db": ensure => $ensure }
} else {
# We have to define two commands here. The first uses creates and is
# responsible for ensuring that the *.db file always exists (and is
# only defined if the type is hash). The second is called by notify
# and is responsible for updating the hash when the source file
# changes. We need both because a command with a creates stanza won't
# run even if notified if that file already exists.
exec { "${command} ${type}:${name} initial":
command => "${command} ${type}:${name}",
creates => "${name}.db",
require => [ File[$name], File['/etc/postfix/main.cf'],
Package['postfix'] ],
}
exec { "${command} ${type}:${name}":
refreshonly => true,
command => "${command} ${type}:${name}",
require => [ File['/etc/postfix/main.cf'],
Package['postfix'] ],
}
# If ensure is absent, remove the detritus of our hash.
if ($ensure == 'absent') {
file { "${name}.db": ensure => $ensure }
} else {
# We have to define two commands here. The first uses creates and is
# responsible for ensuring that the *.db file always exists (and is only
# defined if the type is hash). The second is called by notify and is
# responsible for updating the hash when the source file changes. We need
# both because a command with a creates stanza won't run even if notified
# if that file already exists.
exec { "${command} ${type}:${name} initial":
command => "${command} ${type}:${name}",
creates => "${name}.db",
require => [ File[$name], File['/etc/postfix/main.cf'],
Package['postfix'] ],
}
exec { "${command} ${type}:${name}":
refreshonly => true,
command => "${command} ${type}:${name}",
require => [ File['/etc/postfix/main.cf'], Package['postfix'] ],
}
}
\ No newline at end of file
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment