diff --git a/manifests/params.pp b/manifests/params.pp index 4d00b60bda9deb37ba9b8e38d4fe7c08efaf9127..a2188485baadb1bef3e6812f9a9f912ee7471bf3 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -1,9 +1,9 @@ class postfix::params { case $::osfamily { 'RedHat': { - $seltype = $::lsbmajdistrelease { - '4' => 'etc_t', - '5','6' => 'postfix_etc_t', + $seltype = $::lsbmajdistrelease ? { + '4' => 'etc_t', + /5|6/ => 'postfix_etc_t', default => undef, } @@ -13,7 +13,7 @@ class postfix::params { } 'Debian': { - $seltype = undef, + $seltype = undef $mailx_package = $::lsbdistcodename ? { /sarge|etch|lenny|lucid/ => 'mailx', diff --git a/spec/.rspec b/spec/.rspec new file mode 100644 index 0000000000000000000000000000000000000000..91cd6427ed614c3110602c19d38b1c723e890a79 --- /dev/null +++ b/spec/.rspec @@ -0,0 +1,6 @@ +--format +s +--colour +--loadby +mtime +--backtrace diff --git a/spec/classes/postfix_spec.rb b/spec/classes/postfix_spec.rb new file mode 100644 index 0000000000000000000000000000000000000000..0ee2119cc8f9ad98a0da4808bfa8ab26e03c2cfe --- /dev/null +++ b/spec/classes/postfix_spec.rb @@ -0,0 +1,21 @@ +require 'spec_helper' + +describe 'postfix' do + context 'when on Debian' do + let (:facts) { { + :operatingsystem => 'Debian', + :osfamily => 'Debian', + } } + + it { should contain_package('postfix') } + end + + context 'when on RedHat' do + let (:facts) { { + :operatingsystem => 'RedHat', + :osfamily => 'RedHat', + } } + + it { should contain_package('postfix') } + end +end diff --git a/spec/fixtures/manifests/site.pp b/spec/fixtures/manifests/site.pp new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000000000000000000000000000000000000..4edc9645f9162f416105ded5d20bd74dfd24113a --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,4 @@ +require 'mocha' +require 'rspec-puppet' +require 'puppetlabs_spec_helper/module_spec_helper' + diff --git a/templates/master.cf.debian.erb b/templates/master.cf.debian.erb index 7232a3ee03b6cdcda65c7b14d6dd5df1b593a36c..b07b26db4074ccf4b86e07a1233602abe08c10ab 100644 --- a/templates/master.cf.debian.erb +++ b/templates/master.cf.debian.erb @@ -8,11 +8,11 @@ # (yes) (yes) (yes) (never) (100) # ========================================================================== <% if has_variable?('postfix_master_smtp') -%> -<%= postfix_master_smtp %> -<% elsif postfix_smtp_listen == 'all' -%> +<%= @postfix_master_smtp %> +<% elsif scope.lookupvar('postfix::smtp_listen') == 'all' -%> smtp inet n - - - - smtpd <% else -%> -<%= postfix_smtp_listen %>:smtp inet n - - - - smtpd +<%= scope.lookupvar('postfix::smtp_listen') %>:smtp inet n - - - - smtpd <% end -%> <% if has_variable?('postfix_master_submission') -%> <%= postfix_master_submission %> @@ -68,7 +68,7 @@ scache unix - - - - 1 scache # Also specify in main.cf: maildrop_destination_recipient_limit=1 # maildrop unix - n n - - pipe - flags=DRhu user=<%= postfix_mail_user %> argv=/usr/bin/maildrop -d ${recipient} + flags=DRhu user=<%= scope.lookupvar('postfix::mail_user') %> argv=/usr/bin/maildrop -d ${recipient} # # See the Postfix UUCP_README file for configuration details. # diff --git a/templates/master.cf.redhat.erb b/templates/master.cf.redhat.erb index aaf2483492b1dd5c0ed3064946b86761a8f3536d..cfc4c4050138955844d4151bc12b3123f4df7c51 100644 --- a/templates/master.cf.redhat.erb +++ b/templates/master.cf.redhat.erb @@ -7,10 +7,10 @@ # service type private unpriv chroot wakeup maxproc command + args # (yes) (yes) (yes) (never) (100) # ========================================================================== -<% if postfix_smtp_listen == 'all' -%> +<% if scope.lookupvar('postfix::smtp_listen') == 'all' -%> smtp inet n - n - - smtpd <% else -%> -<%= postfix_smtp_listen %>:smtp inet n - n - - smtpd +<%= scope.lookupvar('postfix::smtp_listen') %>:smtp inet n - n - - smtpd <% end -%> #smtp inet n - n - - smtpd #submission inet n - n - - smtpd