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
e2eaa41d
You need to sign in or sign up before continuing.
Commit
e2eaa41d
authored
11 years ago
by
Wolf Noble
Browse files
Options
Downloads
Patches
Plain Diff
addition to specs.. start whining when incompatable parameters are specified
parent
2e6c7bf5
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
manifests/init.pp
+7
-1
7 additions, 1 deletion
manifests/init.pp
manifests/mta.pp
+2
-2
2 additions, 2 deletions
manifests/mta.pp
manifests/satellite.pp
+1
-1
1 addition, 1 deletion
manifests/satellite.pp
spec/classes/postfix_spec.rb
+154
-0
154 additions, 0 deletions
spec/classes/postfix_spec.rb
with
164 additions
and
4 deletions
manifests/init.pp
+
7
−
1
View file @
e2eaa41d
...
@@ -32,7 +32,7 @@
...
@@ -32,7 +32,7 @@
#
#
# [*master_submission*] - (string)
# [*master_submission*] - (string)
#
#
# [*mta*] - (boolean)
Whether to use as
MTA
# [*mta*] - (boolean)
Configure postfix minimally, as a simple
MTA
#
#
# [*mydestination*] - (string)
# [*mydestination*] - (string)
#
#
...
@@ -140,10 +140,16 @@ class postfix (
...
@@ -140,10 +140,16 @@ class postfix (
}
}
if
$mta
{
if
$mta
{
if
$satellite
{
fail
(
'enabling both the $mta and $satellite parameters is not supported. Please disable one.'
)
}
include
::postfix::mta
include
::postfix::mta
}
}
if
$satellite
{
if
$satellite
{
if
$mta
{
fail
(
'enabling both the $mta and $satellite parameters is not supported. Please disable one.'
)
}
include
::postfix::satellite
include
::postfix::satellite
}
}
...
...
This diff is collapsed.
Click to expand it.
manifests/mta.pp
+
2
−
2
View file @
e2eaa41d
This diff is collapsed.
Click to expand it.
manifests/satellite.pp
+
1
−
1
View file @
e2eaa41d
This diff is collapsed.
Click to expand it.
spec/classes/postfix_spec.rb
+
154
−
0
View file @
e2eaa41d
...
@@ -137,5 +137,159 @@ describe 'postfix' do
...
@@ -137,5 +137,159 @@ describe 'postfix' do
)
}
)
}
end
end
end
end
context
'when on RedHat'
do
let
(
:facts
)
{
{
:operatingsystem
=>
'Debian'
,
:osfamily
=>
'Debian'
,
:fqdn
=>
'fqdn.example.com'
,
}
}
context
'when specifying inet_interfaces'
do
let
(
:params
)
{
{
:inet_interfaces
=>
'localhost2'
}
}
it
'should create a postfix::config defined type with inet_interfaces specified properly'
do
should
contain_postfix__config
(
'inet_interfaces'
).
with_value
(
'localhost2'
)
end
end
context
'when enabling ldap'
do
it
'should do stuff'
do
pending
'need to write this still'
end
end
context
'when a custom mail_user is specified'
do
let
(
:params
)
{
{
:mail_user
=>
'bar'
}
}
it
'should adjust the content of /etc/postfix/master.cf specifying the user'
do
should
contain_file
(
'/etc/postfix/master.cf'
).
without
(
'seltype'
).
with_content
(
/user=bar/
)
end
end
context
'when mailman is true'
do
let
(
:params
)
{
{
:mailman
=>
true
}
}
it
'should do stuff'
do
pending
'need to write this still'
end
end
context
'when specifying a custom mastercf_source'
do
let
(
:params
)
{
{
:mastercf_source
=>
'testy'
}
}
it
'should do stuff'
do
pending
'need to write this still'
end
end
context
'when specifying a custom master_smtp'
do
let
(
:params
)
{
{
:master_smtp
=>
"smtp inet n - - - - smtpd
-o smtpd_client_restrictions=check_client_access,hash:/etc/postfix/access,reject"
,
}
}
it
'should update master.cf with the specified flags to smtp'
do
should
contain_file
(
'/etc/postfix/master.cf'
).
without
(
'seltype'
).
with_content
(
/smtp inet n - - - - smtpd/
).
with_content
(
/^smtp.*\n.*smtpd_client_restrictions=check_client_access,hash:/
)
end
end
context
'when specifying a custom master_smtps'
do
let
(
:params
)
{
{
:master_smtps
=>
'smtps inet n - - - - smtpd'
}
}
it
'should update master.cf with the specified flags to smtps'
do
should
contain_file
(
'/etc/postfix/master.cf'
).
with_content
(
/^smtps inet n/
)
end
end
context
'when mta is enabled'
do
let
(
:params
)
{
{
:mta
=>
true
,
:mydestination
=>
'1.2.3.4'
,
:relayhost
=>
'2.3.4.5'
}
}
it
'should configure postfix as a minimal MTA, delivering mail to the mydestination param'
do
should
contain_postfix__config
(
'mydestination'
).
with_value
(
'1.2.3.4'
)
should
contain_postfix__config
(
'mynetworks'
).
with_value
(
'127.0.0.0/8'
)
should
contain_postfix__config
(
'relayhost'
).
with_value
(
'2.3.4.5'
)
should
contain_postfix__config
(
'virtual_alias_maps'
).
with_value
(
'hash:/etc/postfix/virtual'
)
should
contain_postfix__config
(
'transport_maps'
).
with_value
(
'hash:/etc/postfix/transport'
)
end
it
{
should
include_class
(
'postfix::mta'
)
}
context
'and satellite is also enabled'
do
let
(
:params
)
{
{
:mta
=>
true
,
:satellite
=>
true
,
:mydestination
=>
'1.2.3.4'
,
:relayhost
=>
'2.3.4.5'
}
}
it
'should fail'
do
expect
{
subject
}.
to
raise_error
(
Puppet
::
Error
,
/Please disable one/
)
end
end
end
context
'when specifying mydesitination'
do
it
'should do stuff'
do
pending
'need to write this still'
end
end
context
'when specifying mynetworks'
do
it
'should do stuff'
do
pending
'need to write this still'
end
end
context
'when specifying myorigin'
do
let
(
:params
)
{
{
:myorigin
=>
'localhost'
}
}
it
'should create a postfix::config defined type with myorigin specified properly'
do
should
contain_postfix__config
(
'myorigin'
).
with_value
(
'localhost'
)
end
end
context
'when specifying relayhost'
do
it
'should do stuff'
do
pending
'need to write this still'
end
end
context
'when specifying a root_mail_recipient'
do
let
(
:params
)
{
{
:root_mail_recipient
=>
'foo'
}
}
it
'should contain a Mailalias resource directing roots mail to the required user'
do
should
contain_mailalias
(
'root'
).
with_recipient
(
'foo'
)
end
end
context
'when specifying satellite'
do
let
(
:params
)
{
{
:satellite
=>
true
,
:mydestination
=>
'1.2.3.4'
,
:relayhost
=>
'2.3.4.5'
}
}
it
'should configure all local email to be forwarded to $root_mail_recipient delivered through $relayhost'
do
should
contain_postfix__config
(
'mydestination'
).
with_value
(
'1.2.3.4'
)
should
contain_postfix__config
(
'mynetworks'
).
with_value
(
'127.0.0.0/8'
)
should
contain_postfix__config
(
'relayhost'
).
with_value
(
'2.3.4.5'
)
should
contain_postfix__config
(
'virtual_alias_maps'
).
with_value
(
'hash:/etc/postfix/virtual'
)
should
contain_postfix__config
(
'transport_maps'
).
with_value
(
'hash:/etc/postfix/transport'
)
end
context
'and mta is also enabled'
do
let
(
:params
)
{
{
:mta
=>
true
,
:satellite
=>
true
,
:mydestination
=>
'1.2.3.4'
,
:relayhost
=>
'2.3.4.5'
}
}
it
'should fail'
do
expect
{
subject
}.
to
raise_error
(
Puppet
::
Error
,
/Please disable one/
)
end
end
end
context
'when specifying smtp_listen'
do
let
(
:params
)
{
{
:smtp_listen
=>
'all'
}
}
it
'should do stuff'
do
pending
'need to write this still'
end
end
context
'when use_amavisd is true'
do
let
(
:params
)
{
{
:use_amavisd
=>
true
}
}
it
'should update master.cf with the specified flags to amavis'
do
should
contain_file
(
'/etc/postfix/master.cf'
).
with_content
(
/amavis unix/
)
end
end
context
'when use_dovecot_lda is true'
do
let
(
:params
)
{
{
:use_dovecot_lda
=>
true
}
}
it
'should update master.cf with the specified flags to dovecot'
do
should
contain_file
(
'/etc/postfix/master.cf'
).
with_content
(
/dovecot.*\n.* user=vmail:vmail /
)
end
end
context
'when use_schleuder is true'
do
let
(
:params
)
{
{
:use_schleuder
=>
true
}
}
it
'should update master.cf with the specified flags to schleuder'
do
should
contain_file
(
'/etc/postfix/master.cf'
).
with_content
(
/schleuder/
)
end
end
context
'when use_sympa is true'
do
let
(
:params
)
{
{
:use_sympa
=>
true
}
}
it
'should update master.cf to include sympa'
do
should
contain_file
(
'/etc/postfix/master.cf'
).
with_content
(
/sympa/
)
end
end
end
end
end
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