Commit 04c76b10 authored by Raphaël Pinson's avatar Raphaël Pinson
Browse files

Add $mta and $satellite parameters to the postfix class

parent 70058f1d
......@@ -29,6 +29,11 @@ class postfix (
$master_smtp = undef, # postfix_master_smtp
$master_smtps = undef, # postfix_master_smtps
$master_submission = undef, # postfix_master_submission
$relayhost = undef, # postfix_relayhost
$mydestination = undef, # postfix_mydestination
$mynetworks = undef, # postfix_mynetworks
$mta = false,
$satellite = false,
) inherits postfix::params {
validate_string($smtp_listen)
......@@ -42,6 +47,12 @@ class postfix (
validate_string($inet_interfaces)
validate_string($master_smtp)
validate_string($master_smtps)
validate_string($relayhost)
validate_string($mydestination)
validate_string($mynetworks)
validate_bool($mta)
validate_bool($satellite)
class { 'postfix::packages': } ->
class { 'postfix::files':
......@@ -60,4 +71,12 @@ class postfix (
} ~>
class { 'postfix::service': } ->
Class['postfix']
if $mta {
include ::postfix::mta
}
if $satellite {
include ::postfix::satellite
}
}
......@@ -32,27 +32,17 @@
#
class postfix::mta {
case $postfix_relayhost {
'': { fail('Required $postfix_relayhost variable is not defined.') }
default: {}
}
case $postfix_mydestination {
'': { $postfix_mydestination = '$myorigin' }
default: {}
}
case $postfix_mynetworks {
"": { $postfix_mynetworks = "127.0.0.0/8" }
default: {}
}
include postfix
validate_re($postfix::relayhost, '^\S+$',
'You must pass $relayhost to the postfix class')
validate_re($postfix::mydestination, '^\S+$',
'You must pass $mydestination to the postfix class')
validate_re($postfix::mynetworks, '^\S+$',
'You must pass $mynetworks to the postfix class')
postfix::config {
'mydestination': value => $postfix_mydestination;
'mynetworks': value => $postfix_mynetworks;
'relayhost': value => $postfix_relayhost;
'mydestination': value => $postfix::mydestination;
'mynetworks': value => $postfix::mynetworks;
'relayhost': value => $postfix::relayhost;
'virtual_alias_maps': value => 'hash:/etc/postfix/virtual';
'transport_maps': value => 'hash:/etc/postfix/transport';
}
......
require 'spec_helper'
describe 'postfix::satellite' do
let (:node) { 'foo.example.com' }
let (:facts) { {
:osfamily => 'Debian',
:needs_postfix_class => true,
:osfamily => 'Debian',
:needs_postfix_class_with_params => true,
} }
it { should include_class('postfix::mta') }
it { should contain_postfix__virtual('@foo.example.com').with(
......
......@@ -3,3 +3,11 @@ include ::augeas
if $::needs_postfix_class {
include ::postfix
}
if $::needs_postfix_class_with_params {
class { '::postfix':
relayhost => 'foo',
mydestination => 'bar',
mynetworks => 'baz',
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment