Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Projets publics
Puppet Camptocamp Postfix
Commits
b9fe74da
Commit
b9fe74da
authored
Feb 11, 2015
by
Ben Hocker
Browse files
Resolves issue #55
- Adding tests for ldap.pp - Only install postfix-ldap package on Debian based
parent
89055a99
Changes
2
Hide whitespace changes
Inline
Side-by-side
manifests/ldap.pp
View file @
b9fe74da
...
...
@@ -14,8 +14,10 @@
# include postfix::ldap
#
class
postfix::ldap
{
package
{
'postfix-ldap'
:
}
case
$::osfamily
{
'debian'
:
{
package
{
'postfix-ldap'
:
}
}
default
:
{}
}
if
!
$postfix::ldap_base
{
fail
'Missing $postfix::ldap_base !'
...
...
@@ -36,6 +38,6 @@ class postfix::ldap {
owner
=>
'root'
,
group
=>
'postfix'
,
content
=>
template
(
'postfix/postfix-ldap-aliases.cf.erb'
),
require
=>
P
ackage
[
'postfix-ldap'
],
#TODO: Figure out if should have
require
p
ackage
here
}
}
spec/classes/postfix_spec.rb
View file @
b9fe74da
...
...
@@ -37,6 +37,7 @@ describe 'postfix' do
context
'when on RedHat'
do
let
(
:facts
)
{
{
:lsbdistcodename
=>
'Maipo'
,
:fqdn
=>
'fqdn.example.com'
,
:operatingsystem
=>
'RedHat'
,
:operatingsystemmajrelease
=>
'7'
,
...
...
@@ -162,8 +163,53 @@ describe 'postfix' do
end
end
context
'when enabling ldap'
do
it
'should do stuff'
do
skip
'need to write this still'
context
'when on Debian'
do
let
(
:params
)
{
{
:ldap
=>
true
,
:ldap_base
=>
'dc=example,dc=com'
,
:ldap_host
=>
'host.example.com'
,
}
}
let
(
:facts
)
{
{
:operatingsystem
=>
'Debian'
,
:osfamily
=>
'Debian'
,
:fqdn
=>
'fqdn.example.com'
,
:lsbdistcodename
=>
'wheezy'
,
}
}
it
{
should
contain_package
(
'postfix-ldap'
)
}
it
{
should
contain_file
(
'/etc/postfix/ldap-aliases.cf'
).
with
(
:owner
=>
'root'
,
:group
=>
'postfix'
).
with_content
(
/search_base = /
)
}
end
context
'when on RedHat'
do
let
(
:params
)
{
{
:ldap
=>
true
,
:ldap_base
=>
'dc=example,dc=com'
,
:ldap_host
=>
'host.example.com'
,
}
}
let
(
:facts
)
{
{
:operatingsystem
=>
'RedHat'
,
:osfamily
=>
'RedHat'
,
:operatingsystemmajrelease
=>
'7'
,
:lsbdistcodename
=>
'Maipo'
,
:fqdn
=>
'fqdn.example.com'
,
}
}
it
do
expect
{
should_not
contain_package
(
'postfix-ldap'
)
}
end
it
{
should
contain_file
(
'/etc/postfix/ldap-aliases.cf'
).
with
(
:owner
=>
'root'
,
:group
=>
'postfix'
).
with_content
(
/search_base = /
)
}
end
end
context
'when a custom mail_user is specified'
do
...
...
@@ -195,7 +241,7 @@ describe 'postfix' do
: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
it
'should update master.cf with the specified flags to smtp'
do
is_expected
.
to
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:/
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment