Commit 483bf90c authored by Ben Hocker's avatar Ben Hocker
Browse files

Fixes issue with postfix-ldap package

- Should only install on Debian based OS Family
- Should not install on RedHat based OS Family
parent b9fe74da
--- ---
.travis.yml: .travis.yml:
forge_password: "XAv4O363tng0KuRnu1ZhhwORy+2CF9UQwdwlFmS+NG9jOaTZZN+PMK8iC7OSIvZN6cfKlYjHRHNuxFBnYlnMrLsM9fVxt4NjjznOgIKQpQDleWk4UitZj5ntyHmUtYtofUd5Bhi/sdYXwGN9pVRCrcfFBmsIRq/dOhXD7Wy5KcQ=" forge_password: "XAv4O363tng0KuRnu1ZhhwORy+2CF9UQwdwlFmS+NG9jOaTZZN+PMK8iC7OSIvZN6cfKlYjHRHNuxFBnYlnMrLsM9fVxt4NjjznOgIKQpQDleWk4UitZj5ntyHmUtYtofUd5Bhi/sdYXwGN9pVRCrcfFBmsIRq/dOhXD7Wy5KcQ="
#README.md:
# include: ['.sync/simple_usage.md', '.sync/classes.md']
## Classes
### postfix
The top-level class, to install and configure Postfix.
## Definitions
### postfix::config
Add/alter/remove options in Postfix main configuration file (main.cf)
### postfix::hash
Creates Postfix hashed "map" files, and build the corresponding db file.
### postfix::transport
Manages content in the transport map.
### postfix::virtual
Manages content in the virtual map.
This module requires Augeas.
## Simple usage
include postfix
postfix::config { "relay_domains": value => "localhost host.foo.com" }
## Exec paths
In order to not have any path problem, you should add the following line in
some globally included .pp file:
Exec {
path => '/some/relevant/path:/some/other:...',
}
For example:
Exec {
path => '/bin:/sbin:/usr/sbin:/usr/bin',
}
## 2015-03-24 - Release 1.1.1
- Various spec improvements
## 2015-02-19 - Release 1.1.0
- Various specs improvements
- Fix specs for postfix::config with ensure => blank
- Simplify relationships and avoid spaceship operators
- nexthop parameter is not necessary for postfix::canonical
## 2015-01-07 - Release 1.0.5 ## 2015-01-07 - Release 1.0.5
- Fix unquoted strings in cases - Fix unquoted strings in cases
......
# How to contribute
Please report bugs and feature request using [GitHub issue
tracker](https://github.com/camptocamp/puppet-postfix/issues).
For pull requests, it is very much appreciated to check your Puppet manifest
with [puppet-lint](https://github.com/rodjek/puppet-lint) to follow the recommended Puppet style guidelines from the
[Puppet Labs style guide](http://docs.puppetlabs.com/guides/style_guide.html).
...@@ -2,8 +2,10 @@ source ENV['GEM_SOURCE'] || "https://rubygems.org" ...@@ -2,8 +2,10 @@ source ENV['GEM_SOURCE'] || "https://rubygems.org"
group :development, :unit_tests do group :development, :unit_tests do
gem 'rake', :require => false gem 'rake', :require => false
gem 'rspec-puppet', '~> 2.0', :require => false gem 'rspec', '< 3.2', :require => false if RUBY_VERSION =~ /^1.8/
gem 'rspec-puppet', :require => false
gem 'puppetlabs_spec_helper', :require => false gem 'puppetlabs_spec_helper', :require => false
gem 'metadata-json-lint', :require => false
gem 'puppet-lint', :require => false gem 'puppet-lint', :require => false
gem 'puppet-lint-unquoted_string-check', :require => false gem 'puppet-lint-unquoted_string-check', :require => false
gem 'puppet-lint-empty_string-check', :require => false gem 'puppet-lint-empty_string-check', :require => false
...@@ -14,15 +16,12 @@ group :development, :unit_tests do ...@@ -14,15 +16,12 @@ group :development, :unit_tests do
gem 'puppet-lint-leading_zero-check', :require => false gem 'puppet-lint-leading_zero-check', :require => false
gem 'puppet-lint-trailing_comma-check', :require => false gem 'puppet-lint-trailing_comma-check', :require => false
gem 'puppet-lint-file_ensure-check', :require => false gem 'puppet-lint-file_ensure-check', :require => false
gem 'simplecov', :require => false gem 'puppet-lint-version_comparison-check', :require => false
gem 'rspec-puppet-facts', :require => false gem 'rspec-puppet-facts', :require => false
gem 'json', :require => false
gem 'metadata-json-lint', :require => false
gem 'docker-api', '1.15.0', :require => false
end end
group :system_tests do group :system_tests do
gem 'beaker', :require => false, :git => 'https://github.com/raphink/beaker', :branch => 'openstack' gem 'beaker', :require => false
gem 'beaker-rspec', :require => false gem 'beaker-rspec', :require => false
gem 'serverspec', :require => false gem 'serverspec', :require => false
end end
......
# Postfix module for Puppet # Postfix Puppet Module
[![Puppet Forge](http://img.shields.io/puppetforge/v/camptocamp/postfix.svg)](https://forge.puppetlabs.com/camptocamp/postfix) [![Puppet Forge Version](http://img.shields.io/puppetforge/v/camptocamp/postfix.svg)](https://forge.puppetlabs.com/camptocamp/postfix)
[![Build Status](https://travis-ci.org/camptocamp/puppet-postfix.png?branch=master)](https://travis-ci.org/camptocamp/puppet-postfix) [![Puppet Forge Downloads](http://img.shields.io/puppetforge/dt/camptocamp/postfix.svg)](https://forge.puppetlabs.com/camptocamp/postfix)
[![Build Status](https://img.shields.io/travis/camptocamp/puppet-postfix/master.svg)](https://travis-ci.org/camptocamp/puppet-postfix)
**Manages Postfix configuration.** [![Gemnasium](https://img.shields.io/gemnasium/camptocamp/puppet-postfix.svg)](https://gemnasium.com/camptocamp/puppet-postfix)
[![By Camptocamp](https://img.shields.io/badge/by-camptocamp-fb7047.svg)](http://www.camptocamp.com)
This module is provided by [Camptocamp](http://www.camptocamp.com/)
This module requires Augeas. This module requires Augeas.
...@@ -54,29 +53,4 @@ Manages content in the transport map. ...@@ -54,29 +53,4 @@ Manages content in the transport map.
Manages content in the virtual map. Manages content in the virtual map.
## Contributing
Please report bugs and feature request using [GitHub issue
tracker](https://github.com/camptocamp/puppet-postfix/issues).
For pull requests, it is very much appreciated to check your Puppet manifest
with [puppet-lint](https://github.com/camptocamp/puppet-postfix/issues) to follow the recommended Puppet style guidelines from the
[Puppet Labs style guide](http://docs.puppetlabs.com/guides/style_guide.html).
## License
Copyright (c) 2013 <mailto:puppet@camptocamp.com> All rights reserved.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
...@@ -2,14 +2,10 @@ require 'puppetlabs_spec_helper/rake_tasks' ...@@ -2,14 +2,10 @@ require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet-lint/tasks/puppet-lint' require 'puppet-lint/tasks/puppet-lint'
Rake::Task[:lint].clear Rake::Task[:lint].clear
PuppetLint.configuration.fail_on_warnings PuppetLint::RakeTask.new :lint do |config|
PuppetLint.configuration.send('relative') config.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp", "vendor/**/*.pp"]
PuppetLint.configuration.send('disable_80chars') config.disable_checks = ['80chars']
PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp", "vendor/**/*.pp"] config.fail_on_warnings = true
end
PuppetSyntax.exclude_paths = ["spec/fixtures/**/*.pp", "vendor/**/*"] PuppetSyntax.exclude_paths = ["spec/fixtures/**/*.pp", "vendor/**/*"]
desc "Lint metadata.json file"
task :metadata do
sh "metadata-json-lint metadata.json"
end
...@@ -31,8 +31,10 @@ define postfix::hash ( ...@@ -31,8 +31,10 @@ define postfix::hash (
include ::postfix::params include ::postfix::params
validate_absolute_path($name) validate_absolute_path($name)
validate_string($source) # validate_string($source)
validate_string($content) # validate_string($content)
if !is_string($source) and !is_array($source) { fail("value for source should be either String type or Array type got ${source}") }
if !is_string($content) and !is_array($content) { fail("value for source should be either String type or Array type got ${content}") }
validate_string($ensure) validate_string($ensure)
validate_re($ensure, ['present', 'absent'], validate_re($ensure, ['present', 'absent'],
"\$ensure must be either 'present' or 'absent', got '${ensure}'") "\$ensure must be either 'present' or 'absent', got '${ensure}'")
...@@ -66,6 +68,7 @@ define postfix::hash ( ...@@ -66,6 +68,7 @@ define postfix::hash (
exec {"generate ${name}.db": exec {"generate ${name}.db":
command => "postmap ${name}", command => "postmap ${name}",
path => $::path,
#creates => "${name}.db", # this prevents postmap from being run ! #creates => "${name}.db", # this prevents postmap from being run !
subscribe => File[$name], subscribe => File[$name],
refreshonly => true, refreshonly => true,
......
...@@ -82,7 +82,7 @@ class postfix ( ...@@ -82,7 +82,7 @@ class postfix (
$master_submission = undef, # postfix_master_submission $master_submission = undef, # postfix_master_submission
$mta = false, $mta = false,
$mydestination = '$myorigin', # postfix_mydestination $mydestination = '$myorigin', # postfix_mydestination
$mynetworks = '127.0.0.0/8', # postfix_mynetworks $mynetworks = '127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128', # postfix_mynetworks
$myorigin = $::fqdn, $myorigin = $::fqdn,
$relayhost = undef, # postfix_relayhost $relayhost = undef, # postfix_relayhost
$root_mail_recipient = 'nobody', # root_mail_recipient $root_mail_recipient = 'nobody', # root_mail_recipient
......
...@@ -14,9 +14,10 @@ ...@@ -14,9 +14,10 @@
# include postfix::ldap # include postfix::ldap
# #
class postfix::ldap { class postfix::ldap {
case $::osfamily { if $::osfamily == 'Debian' {
'debian': { package {'postfix-ldap': } } package {'postfix-ldap':
default: {} before => File['/etc/postfix/ldap-aliases.cf'],
}
} }
if ! $postfix::ldap_base { if ! $postfix::ldap_base {
...@@ -38,6 +39,5 @@ class postfix::ldap { ...@@ -38,6 +39,5 @@ class postfix::ldap {
owner => 'root', owner => 'root',
group => 'postfix', group => 'postfix',
content => template('postfix/postfix-ldap-aliases.cf.erb'), content => template('postfix/postfix-ldap-aliases.cf.erb'),
#TODO: Figure out if should have require package here
} }
} }
...@@ -35,7 +35,7 @@ class postfix::mta ( ...@@ -35,7 +35,7 @@ class postfix::mta (
'Wrong value for $relayhost') 'Wrong value for $relayhost')
validate_re($mydestination, '^\S+(?:,\s*\S+)*$', validate_re($mydestination, '^\S+(?:,\s*\S+)*$',
'Wrong value for $mydestination') 'Wrong value for $mydestination')
validate_re($mynetworks, '^\S+$', validate_re($mynetworks, '^(?:\S+?(?:(?:,\s)|(?:\s))?)*$',
'Wrong value for $mynetworks') 'Wrong value for $mynetworks')
# If direct is specified then relayhost should be blank # If direct is specified then relayhost should be blank
......
...@@ -7,6 +7,11 @@ class postfix::params { ...@@ -7,6 +7,11 @@ class postfix::params {
default => undef, default => undef,
} }
$restart_cmd = $::operatingsystemmajrelease ? {
'7' => '/bin/systemctl reload postfix',
default => '/etc/init.d/postfix reload',
}
$mailx_package = 'mailx' $mailx_package = 'mailx'
$master_os_template = "${module_name}/master.cf.redhat.erb" $master_os_template = "${module_name}/master.cf.redhat.erb"
...@@ -15,9 +20,11 @@ class postfix::params { ...@@ -15,9 +20,11 @@ class postfix::params {
'Debian': { 'Debian': {
$seltype = undef $seltype = undef
$restart_cmd = '/etc/init.d/postfix reload'
$mailx_package = $::lsbdistcodename ? { $mailx_package = $::lsbdistcodename ? {
/sarge|etch|lenny|lucid/ => 'mailx', /sarge|etch|lenny/ => 'mailx',
default => 'bsd-mailx', default => 'bsd-mailx',
} }
$master_os_template = "${module_name}/master.cf.debian.erb" $master_os_template = "${module_name}/master.cf.debian.erb"
...@@ -26,6 +33,8 @@ class postfix::params { ...@@ -26,6 +33,8 @@ class postfix::params {
'Suse': { 'Suse': {
$seltype = undef $seltype = undef
$restart_cmd = '/etc/init.d/postfix reload'
$mailx_package = 'mailx' $mailx_package = 'mailx'
if $::operatingsystem != 'SLES' { if $::operatingsystem != 'SLES' {
......
...@@ -3,6 +3,6 @@ class postfix::service { ...@@ -3,6 +3,6 @@ class postfix::service {
ensure => running, ensure => running,
enable => true, enable => true,
hasstatus => true, hasstatus => true,
restart => '/etc/init.d/postfix reload', restart => $::postfix::params::restart_cmd,
} }
} }
{ {
"name": "camptocamp-postfix", "name": "camptocamp-postfix",
"version": "1.0.5", "version": "1.1.1",
"author": "Camptocamp", "author": "Camptocamp",
"summary": "Camptocamp Postfix Module", "summary": "Camptocamp Postfix Module",
"license": "Apache-2.0", "license": "Apache-2.0",
...@@ -48,7 +48,8 @@ ...@@ -48,7 +48,8 @@
"operatingsystem": "RedHat", "operatingsystem": "RedHat",
"operatingsystemrelease": [ "operatingsystemrelease": [
"5", "5",
"6" "6",
"7"
] ]
} }
], ],
......
...@@ -4,7 +4,7 @@ HOSTS: ...@@ -4,7 +4,7 @@ HOSTS:
strict_variables: strict_variables:
platform: el-7-x86_64 platform: el-7-x86_64
hypervisor : openstack hypervisor : openstack
flavor: m1.small flavor: m1.medium
image: centos-7-x86_64-genericcloud-20140929_01 image: centos-7-x86_64-genericcloud-20140929_01
user: centos user: centos
CONFIG: CONFIG:
......
...@@ -4,7 +4,7 @@ HOSTS: ...@@ -4,7 +4,7 @@ HOSTS:
strict_variables: strict_variables:
platform: el-7-x86_64 platform: el-7-x86_64
hypervisor : vagrant hypervisor : vagrant
box : puppetlabs/centos-6.5-64-nocm box : puppetlabs/centos-7.0-64-nocm
CONFIG: CONFIG:
type: foss type: foss
log_level: debug log_level: debug
HOSTS:
debian-6-x64:
default_apply_opts:
strict_variables:
platform: debian-6-amd64
hypervisor : vagrant
box : puppetlabs/debian-6.0.10-64-nocm
CONFIG:
type: foss
log_level: debug
...@@ -4,7 +4,7 @@ HOSTS: ...@@ -4,7 +4,7 @@ HOSTS:
strict_variables: strict_variables:
platform: debian-7-amd64 platform: debian-7-amd64
hypervisor : openstack hypervisor : openstack
flavor: m1.small flavor: m1.medium
image: debian-7-amd64-20141121 image: debian-7-amd64-20141121
user: debian user: debian
CONFIG: CONFIG:
......
...@@ -4,8 +4,7 @@ HOSTS: ...@@ -4,8 +4,7 @@ HOSTS:
strict_variables: strict_variables:
platform: debian-7-amd64 platform: debian-7-amd64
hypervisor : vagrant hypervisor : vagrant
box : debian-73-x64-virtualbox-nocm box : puppetlabs/debian-7.8-64-nocm
box_url : http://puppet-vagrant-boxes.puppetlabs.com/debian-73-x64-virtualbox-nocm.box
CONFIG: CONFIG:
type: foss type: foss
log_level: debug log_level: debug
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment