Skip to content

Commit 9c745e5

Browse files
committed
make it possible to provide inital seed data for the virtual and transport files that will be setup if you set mta to true
1 parent d4058dc commit 9c745e5

File tree

2 files changed

+34
-2
lines changed

2 files changed

+34
-2
lines changed

manifests/init.pp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,22 @@
187187
# A Boolean to define whether to configure Postfix as a mail transfer agent.
188188
# This option is mutually exclusive with the satellite Boolean.
189189
#
190+
# @param mta_virtual_content
191+
# A free form string that defines the contents of the virtual file. Only used if mta is true.
192+
# This parameter is mutually exclusive with mta_virtual_source.
193+
#
194+
# @param mta_virtual_source
195+
# A String whose value is a location for the source file to be used for the virtual file.
196+
# Only used if mta is true. This parameter is mutually exclusive with mta_virtual_content.
197+
#
198+
# @param mta_transport_content
199+
# A free form string that defines the contents of the transport file. Only used if mta is true.
200+
# This parameter is mutually exclusive with mta_transport_source.
201+
#
202+
# @param mta_transport_source
203+
# A String whose value is a location for the source file to be used for the transport file.
204+
# Only used if mta is true. This parameter is mutually exclusive with mta_transport_content.
205+
#
190206
# @param mydestination
191207
# A string to define the mydestination parameter in main.cf (postconf(5)).
192208
# Example: `example.com, foo.example.com`.
@@ -286,6 +302,10 @@
286302
Optional[Array[String[1]]] $masquerade_domains = undef,
287303
Optional[Array[String[1]]] $masquerade_exceptions = undef,
288304
Boolean $mta = false,
305+
Optional[String] $mta_virtual_content = undef,
306+
Optional[String] $mta_virtual_source = undef,
307+
Optional[String] $mta_transport_content = undef,
308+
Optional[String] $mta_transport_source = undef,
289309
String $mydestination = '$myhostname, localhost.$mydomain, localhost', # postfix_mydestination
290310
String $mynetworks = '127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128', # postfix_mynetworks
291311
String $myorigin = $facts['networking']['fqdn'],
@@ -371,6 +391,14 @@
371391
include postfix::ldap
372392
}
373393

394+
if $mta_virtual_content and $mta_virtual_source {
395+
fail('You must provide either \'mta_virtual_content\' or \'mta_virtual_source\', not both.')
396+
}
397+
398+
if $mta_transport_content and $mta_transport_source {
399+
fail('You must provide either \'mta_transport_content\' or \'mta_transport_source\', not both.')
400+
}
401+
374402
if $mta {
375403
if $satellite {
376404
fail('enabling both the $mta and $satellite parameters is not supported. Please disable one.')

manifests/mta.pp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,14 @@
5151
}
5252

5353
postfix::hash { "${postfix::confdir}/virtual":
54-
ensure => 'present',
54+
ensure => 'present',
55+
content => $postfix::mta_virtual_content,
56+
source => $postfix::mta_virtual_source,
5557
}
5658

5759
postfix::hash { "${postfix::confdir}/transport":
58-
ensure => 'present',
60+
ensure => 'present',
61+
content => $postfix::mta_transport_content,
62+
source => $postfix::mta_transport_source,
5963
}
6064
}

0 commit comments

Comments
 (0)