Skip to content

Commit

Permalink
postfix: squeeze fix - replace broken exec by augeas resources.
Browse files Browse the repository at this point in the history
  • Loading branch information
Marc Fournier committed Aug 10, 2010
1 parent 512834f commit 37988a6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion manifests/classes/postfix-mailman.pp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"mydestination": value => "";
"virtual_alias_maps": value => "hash:/etc/postfix/virtual";
"transport_maps": value => "hash:/etc/postfix/transport";
"mailman_destination_recipient_limit": value => "1", nonstandard => true;
"mailman_destination_recipient_limit": value => "1";
}

postfix::hash { "/etc/postfix/virtual":
Expand Down
24 changes: 13 additions & 11 deletions manifests/definitions/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
- *name*: name of the parameter.
- *ensure*: present/absent. defaults to present.
- *value*: value of the parameter.
- *nonstandard*: inform postfix::config that this parameter is not recognized
by the "postconf" command. defaults to false.
Requires:
- Class["postfix"]
Expand All @@ -29,21 +27,25 @@
}
*/
define postfix::config ($ensure = present, $value, $nonstandard = false) {
define postfix::config ($ensure = present, $value) {

Augeas {
context => "/files/etc/postfix/main.cf",
notify => Service["postfix"],
require => File["/etc/postfix/main.cf"],
}

case $ensure {
present: {
exec {"postconf -e ${name}='${value}'":
unless => $nonstandard ? {
false => "test \"x$(postconf -h ${name})\" == 'x${value}'",
true => "test \"x$(egrep '^${name} ' /etc/postfix/main.cf | cut -d= -f2 | cut -d' ' -f2)\" == 'x${value}'",
},
notify => Service["postfix"],
require => File["/etc/postfix/main.cf"],
augeas { "set postfix $name to $value":
changes => "set $name $value",
}
}

absent: {
fail "postfix::config ensure => absent: Not implemented"
augeas { "set postfix $name to $value":
changes => "rm $name",
}
}
}
}

0 comments on commit 37988a6

Please sign in to comment.