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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Projets publics
Puppet Camptocamp Postfix
Commits
4f935088
Unverified
Commit
4f935088
authored
Oct 2, 2020
by
Julian
Committed by
GitHub
Oct 2, 2020
Browse files
Options
Downloads
Patches
Plain Diff
Feature/allow specify master cf content & template (#217)
Add possibility to specify a template for master.cf Closes #91
parent
a3bbeb96
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
manifests/files.pp
+9
-3
9 additions, 3 deletions
manifests/files.pp
manifests/init.pp
+13
-0
13 additions, 0 deletions
manifests/init.pp
spec/classes/postfix_spec.rb
+53
-0
53 additions, 0 deletions
spec/classes/postfix_spec.rb
with
75 additions
and
3 deletions
manifests/files.pp
+
9
−
3
View file @
4f935088
...
...
@@ -8,6 +8,8 @@ class postfix::files {
$manage_conffiles
=
$postfix::manage_conffiles
$maincf_source
=
$postfix::maincf_source
$mastercf_source
=
$postfix::mastercf_source
$mastercf_content
=
$postfix::mastercf_content
$mastercf_template
=
$postfix::mastercf_template
$master_smtp
=
$postfix::master_smtp
$master_smtps
=
$postfix::master_smtps
$master_submission
=
$postfix::master_submission
...
...
@@ -58,9 +60,13 @@ class postfix::files {
# Config files
if
$mastercf_source
{
$mastercf_content
=
undef
$_mastercf_content
=
undef
}
elsif
$mastercf_content
{
$_mastercf_content
=
$mastercf_content
}
elsif
$mastercf_template
{
$_mastercf_content
=
epp
(
$mastercf_template
)
}
else
{
$mastercf_content
=
template
(
$
_
mastercf_content
=
template
(
$postfix::params::master_os_template
,
'postfix/master.cf.common.erb'
)
...
...
@@ -68,7 +74,7 @@ class postfix::files {
file
{
'/etc/postfix/master.cf'
:
ensure
=>
'file'
,
content
=>
$mastercf_content
,
content
=>
$
_
mastercf_content
,
group
=>
'root'
,
mode
=>
'0644'
,
owner
=>
'root'
,
...
...
This diff is collapsed.
Click to expand it.
manifests/init.pp
+
13
−
0
View file @
4f935088
...
...
@@ -34,6 +34,10 @@
#
# [*mastercf_source*] - (string)
#
# [*mastercf_content*] - (string)
#
# [*mastercf_template*] - (string)
#
# [*master_smtp*] - (string)
#
# [*master_smtps*] - (string)
...
...
@@ -101,6 +105,8 @@ class postfix (
Boolean
$manage_conffiles
=
true
,
Boolean
$manage_mailx
=
true
,
Optional
[
String
]
$mastercf_source
=
undef
,
Optional
[
String
]
$mastercf_content
=
undef
,
Optional
[
String
]
$mastercf_template
=
undef
,
Optional
[
String
]
$master_smtp
=
undef
,
# postfix_master_smtp
Optional
[
String
]
$master_smtps
=
undef
,
# postfix_master_smtps
Optional
[
String
]
$master_submission
=
undef
,
# postfix_master_submission
...
...
@@ -128,6 +134,13 @@ class postfix (
Boolean
$service_enabled
=
true
,
)
inherits
postfix::params
{
if
((
$mastercf_source
and
$mastercf_content
)
or
(
$mastercf_source
and
$mastercf_template
)
or
(
$mastercf_content
and
$mastercf_template
)
or
(
$mastercf_source
and
$mastercf_content
and
$mastercf_template
)){
fail
(
'mastercf_source, mastercf_content and mastercf_template are mutually exclusive'
)
}
$_smtp_listen
=
$mailman
?
{
true
=>
'0.0.0.0'
,
default
=>
$smtp_listen
,
...
...
This diff is collapsed.
Click to expand it.
spec/classes/postfix_spec.rb
+
53
−
0
View file @
4f935088
...
...
@@ -221,6 +221,59 @@ describe 'postfix' do
skip
'need to write this still'
end
end
context
'when specifying a custom mastercf_content'
do
let
(
:params
)
{
{
:mastercf_content
=>
'testy'
}
}
it
'should do stuff'
do
skip
'need to write this still'
end
end
context
'when specifying a custom mastercf_template'
do
let
(
:params
)
{
{
:mastercf_template
=>
'testy'
}
}
it
'should do stuff'
do
skip
'need to write this still'
end
end
context
'when specifying a custom mastercf_source and mastercf_content'
do
let
(
:params
)
{
{
:mastercf_source
=>
'testy_1'
,
:mastercf_content
=>
'testy_2'
}
}
it
'should fail'
do
expect
{
should
compile
}.
to
raise_error
(
/mutually exclusive/
)
end
end
context
'when specifying a custom mastercf_source and mastercf_template'
do
let
(
:params
)
{
{
:mastercf_source
=>
'testy_1'
,
:mastercf_template
=>
'testy_2'
}
}
it
'should fail'
do
expect
{
should
compile
}.
to
raise_error
(
/mutually exclusive/
)
end
end
context
'when specifying a custom mastercf_content and mastercf_template'
do
let
(
:params
)
{
{
:mastercf_content
=>
'testy_1'
,
:mastercf_template
=>
'testy_2'
}
}
it
'should fail'
do
expect
{
should
compile
}.
to
raise_error
(
/mutually exclusive/
)
end
end
context
'when specifying a mastercf_source and custom mastercf_content and mastercf_template'
do
let
(
:params
)
{
{
:mastercf_source
=>
'testy_1'
,
:mastercf_content
=>
'testy_2'
,
:mastercf_template
=>
'testy_3'
}
}
it
'should fail'
do
expect
{
should
compile
}.
to
raise_error
(
/mutually exclusive/
)
end
end
context
'when specifying a custom master_smtp'
do
let
(
:params
)
do
{
...
...
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