From 37988a6b22de5d049a0bf3a65262b8faadf29a22 Mon Sep 17 00:00:00 2001 From: Marc Fournier Date: Tue, 10 Aug 2010 14:07:51 +0200 Subject: [PATCH] postfix: squeeze fix - replace broken exec by augeas resources. --- manifests/classes/postfix-mailman.pp | 2 +- manifests/definitions/config.pp | 24 +++++++++++++----------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/manifests/classes/postfix-mailman.pp b/manifests/classes/postfix-mailman.pp index cba08486..47f03ac1 100644 --- a/manifests/classes/postfix-mailman.pp +++ b/manifests/classes/postfix-mailman.pp @@ -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": diff --git a/manifests/definitions/config.pp b/manifests/definitions/config.pp index aaf73b56..4128f4f8 100644 --- a/manifests/definitions/config.pp +++ b/manifests/definitions/config.pp @@ -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"] @@ -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", + } } } }