From dd50140ddb29aca216be2ccb77f3722eb58f675e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Pinson?= <raphael.pinson@camptocamp.com> Date: Mon, 27 May 2013 15:59:22 +0200 Subject: [PATCH] Refactor postfix::mailman --- manifests/init.pp | 13 ++++++++++++- manifests/mailman.pp | 13 +++++-------- spec/classes/postfix_mailman_spec.rb | 4 ++++ 3 files changed, 21 insertions(+), 9 deletions(-) create mode 100644 spec/classes/postfix_mailman_spec.rb diff --git a/manifests/init.pp b/manifests/init.pp index 5b97d94..850e702 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -34,6 +34,7 @@ class postfix ( $mynetworks = undef, # postfix_mynetworks $mta = false, $satellite = false, + $mailman = false, ) inherits postfix::params { validate_string($smtp_listen) @@ -53,10 +54,16 @@ class postfix ( validate_bool($mta) validate_bool($satellite) + validate_bool($mailman) + + $_smtp_listen = $mailman ? { + true => '0.0.0.0', + default => $smtp_listen, + } class { 'postfix::packages': } -> class { 'postfix::files': - smtp_listen => $smtp_listen, + smtp_listen => $_smtp_listen, root_mail_recipient => $root_mail_recipient, use_amavisd => $use_amavisd, use_dovecot_lda => $use_dovecot_lda, @@ -79,4 +86,8 @@ class postfix ( if $satellite { include ::postfix::satellite } + + it $mailman { + include ::postfix::mailman + } } diff --git a/manifests/mailman.pp b/manifests/mailman.pp index c3eb7e8..fc5f900 100644 --- a/manifests/mailman.pp +++ b/manifests/mailman.pp @@ -1,22 +1,19 @@ -# # == Class: postfix::mailman # # Configures a basic smtp server, able to work for the mailman mailing-list # manager. # -# Parameters: -# - every global variable which works for class 'postfix' will work here. -# # Example usage: # # node 'toto.example.com' { -# include mailman -# include postfix::mailman +# class { '::postfix': +# mailman => true, +# } # } # +# /!\ Do not include this class directly anymore, +# use mailman => true in the postfix top class! class postfix::mailman { - $postfix_smtp_listen = '0.0.0.0' - include postfix postfix::config { 'virtual_alias_maps': diff --git a/spec/classes/postfix_mailman_spec.rb b/spec/classes/postfix_mailman_spec.rb new file mode 100644 index 0000000..15217b4 --- /dev/null +++ b/spec/classes/postfix_mailman_spec.rb @@ -0,0 +1,4 @@ +require 'spec_helper' + +describe 'postfix::mailman' do +end -- GitLab