Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Puppet Camptocamp Postfix
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Projets publics
Puppet Camptocamp Postfix
Commits
e1255f78
Commit
e1255f78
authored
11 years ago
by
Raphaël Pinson
Browse files
Options
Downloads
Plain Diff
Merge pull request #37 from vrillusions/allow-direct-delivery
Allow having mta send mail directly.
parents
1eb19d36
2f461e79
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
manifests/config.pp
+18
-5
18 additions, 5 deletions
manifests/config.pp
manifests/mta.pp
+12
-3
12 additions, 3 deletions
manifests/mta.pp
spec/defines/postfix_config_spec.rb
+2
-2
2 additions, 2 deletions
spec/defines/postfix_config_spec.rb
with
32 additions
and
10 deletions
manifests/config.pp
+
18
−
5
View file @
e1255f78
...
...
@@ -9,7 +9,7 @@
# === Parameters
#
# [*name*] - name of the parameter.
# [*ensure*] - present/absent. defaults to present.
# [*ensure*] - present/absent
/blank
. defaults to present.
# [*value*] - value of the parameter.
#
# === Requires
...
...
@@ -23,12 +23,20 @@
# value => 'yes',
# }
#
define
postfix::config
(
$value
,
$ensure
=
present
)
{
# postfix::config { 'relayhost':
# ensure => 'blank',
# }
#
define
postfix::config
(
$value
=
undef
,
$ensure
=
'present'
)
{
validate_string
(
$value
)
validate_string
(
$ensure
)
validate_re
(
$ensure
,
[
'present'
,
'absent'
],
"
\$
ensure must be either 'present' or 'absent', got '
${ensure}
'"
)
validate_re
(
$ensure
,
[
'present'
,
'absent'
,
'blank'
],
"
\$
ensure must be either 'present', 'absent' or 'blank', got '
${ensure}
'"
)
if
(
$ensure
==
'present'
)
{
validate_string
(
$value
)
validate_re
(
$value
,
'^.+$'
,
'$value can not be empty if ensure = present'
)
}
if
(
!
defined
(
Class
[
'postfix'
]))
{
fail
'You must define class postfix before using postfix::config!'
...
...
@@ -51,6 +59,11 @@ define postfix::config ($value, $ensure = present) {
changes
=>
"rm
${name}
"
,
}
}
blank
:
{
augeas
{
"blank postfix '
${name}
'"
:
changes
=>
"clear
${name}
"
,
}
}
default
:
{}
}
}
This diff is collapsed.
Click to expand it.
manifests/mta.pp
+
12
−
3
View file @
e1255f78
...
...
@@ -3,14 +3,16 @@
# This class configures a minimal MTA, delivering mail to
# $mydestination.
#
# A valid relay host is required ($relayhost) for outbound email.
# Either a valid relay host or the special word 'direct' is required
# ($relayhost) for outbound email.
#
# transport & virtual maps get configured and can be populated with
# postfix::transport and postfix::virtual
#
# === Parameters
#
# [*relayhost*] - (string) the relayhost to use
# [*relayhost*] - (string) the relayhost to use or 'direct' to send mail
# directly without a relay.
# [*mydestination*] - (string)
# [*mynetworks*] - (string)
#
...
...
@@ -36,10 +38,17 @@ class postfix::mta (
validate_re
(
$mynetworks
,
'^\S+$'
,
'Wrong value for $mynetworks'
)
# If direct is specified then relayhost should be blank
if
(
$relayhost
==
'direct'
)
{
postfix::config
{
'relayhost'
:
ensure
=>
'blank'
}
}
else
{
postfix::config
{
'relayhost'
:
value
=>
$relayhost
}
}
postfix::config
{
'mydestination'
:
value
=>
$mydestination
;
'mynetworks'
:
value
=>
$mynetworks
;
'relayhost'
:
value
=>
$relayhost
;
'virtual_alias_maps'
:
value
=>
'hash:/etc/postfix/virtual'
;
'transport_maps'
:
value
=>
'hash:/etc/postfix/transport'
;
}
...
...
This diff is collapsed.
Click to expand it.
spec/defines/postfix_config_spec.rb
+
2
−
2
View file @
e1255f78
...
...
@@ -11,7 +11,7 @@ describe 'postfix::config' do
it
'should fail'
do
expect
{
should
contain_augeas
(
"set postfix 'foo'"
)
}.
to
raise_error
(
Puppet
::
Error
,
/
Must pass value to Postfix::Config
/
)
}.
to
raise_error
(
Puppet
::
Error
,
/
value can not be empty
/
)
end
end
...
...
@@ -46,7 +46,7 @@ describe 'postfix::config' do
it
'should fail'
do
expect
{
should
contain_augeas
(
"set postfix 'foo'"
)
}.
to
raise_error
(
Puppet
::
Error
,
/must be either 'present'
or
'absent'/
)
}.
to
raise_error
(
Puppet
::
Error
,
/must be either 'present'
,
'absent'
or 'blank'
/
)
end
end
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment