Merge branch 'master' of git://github.com/chef-cookbooks/postfix into chef-cookbooks-master

This commit is contained in:
Stanislav Voroniy 2015-12-22 13:09:40 +01:00
commit 65df142b24
18 changed files with 356 additions and 200 deletions

View File

@ -1,162 +0,0 @@
---
driver_config:
digitalocean_client_id: <%= ENV['DIGITAL_OCEAN_CLIENT_ID'] %>
digitalocean_api_key: <%= ENV['DIGITAL_OCEAN_API_KEY'] %>
google_client_email: <%= ENV['GOOGLE_CLIENT_EMAIL'] %>
google_key_location: <%= ENV['GOOGLE_KEY_LOCATION'] %>
google_project: <%= ENV['GOOGLE_PROJECT'] %>
joyent_username: <%= ENV['SDC_CLI_ACCOUNT'] %>
joyent_keyfile: <%= ENV['SDC_CLI_IDENTITY'] %>
joyent_keyname: <%= ENV['SDC_CLI_KEY_ID'] %>
joyent_url: <%= ENV['SDC_CLI_URL'] %>
aws_access_key_id: <%= ENV['AWS_ACCESS_KEY_ID'] %>
aws_secret_access_key: <%= ENV['AWS_SECRET_ACCESS_KEY'] %>
aws_ssh_key_id: <%= ENV['AWS_KEYPAIR_NAME'] %>
availability_zone: <%= ENV['AWS_AVAILABILITY_ZONE'] %>
provisioner:
name: chef_zero
require_chef_omnibus: 11.12.8
platforms:
- name: centos-5.8
driver_plugin: digitalocean
driver_config:
image_id: 1601
flavor_id: 63
region_id: 4
ssh_key_ids: <%= ENV['DIGITAL_OCEAN_SSH_KEY_IDS'] %>
ssh_key: <%= ENV['DIGITAL_OCEAN_SSH_KEY_PATH'] %>
- name: centos-6.5
driver_plugin: digitalocean
driver_config:
image_id: 3448641
flavor_id: 63
region_id: 4
ssh_key_ids: <%= ENV['DIGITAL_OCEAN_SSH_KEY_IDS'] %>
ssh_key: <%= ENV['DIGITAL_OCEAN_SSH_KEY_PATH'] %>
- name: amazon-2013.09
driver_plugin: ec2
driver_config:
image_id: ami-3be4bc52
username: ec2-user
ssh_key: <%= ENV['EC2_SSH_KEY_PATH'] %>
- name: amazon-2014.03
driver_plugin: ec2
driver_config:
image_id: ami-6b726502
username: ec2-user
ssh_key: <%= ENV['EC2_SSH_KEY_PATH'] %>
# - name: fedora-19
# driver_plugin: digitalocean
# driver_config:
# image_id: 3102879
# flavor_id: 63
# region_id: 4
# ssh_key_ids: <%= ENV['DIGITAL_OCEAN_SSH_KEY_IDS'] %>
# ssh_key: <%= ENV['DIGITAL_OCEAN_SSH_KEY_PATH'] %>
- name: debian-7.0
driver_plugin: gce
driver_config:
image_name: debian-7-wheezy-v20131120
zone: <%= ENV['GCE_ZONE'] %>
area: <%= ENV['GCE_AREA'] %>
network: <%= ENV['GCE_NETWORK'] %>
username: <%= ENV['GCE_USERNAME'] %>
public_key_path: <%= ENV['GCE_PUBLIC_KEY_PATH'] %>
ssh_key: <%= ENV['GCE_SSH_KEY_PATH'] %>
run_list:
- recipe[apt]
- name: ubuntu-10.04
driver_plugin: digitalocean
driver_config:
image_id: 14097
flavor_id: 63
region_id: 4
ssh_key_ids: <%= ENV['DIGITAL_OCEAN_SSH_KEY_IDS'] %>
ssh_key: <%= ENV['DIGITAL_OCEAN_SSH_KEY_PATH'] %>
run_list:
- recipe[apt]
- name: ubuntu-12.04
driver_plugin: digitalocean
driver_config:
image_id: 3101045
flavor_id: 63
region_id: 4
ssh_key_ids: <%= ENV['DIGITAL_OCEAN_SSH_KEY_IDS'] %>
ssh_key: <%= ENV['DIGITAL_OCEAN_SSH_KEY_PATH'] %>
run_list:
- recipe[apt]
- name: ubuntu-14.04
driver_plugin: digitalocean
driver_config:
image_id: 3240036
flavor_id: 63
region_id: 4
ssh_key_ids: <%= ENV['DIGITAL_OCEAN_SSH_KEY_IDS'] %>
ssh_key: <%= ENV['DIGITAL_OCEAN_SSH_KEY_PATH'] %>
run_list:
- recipe[apt]
- name: smartos-13.4.0
driver_plugin: joyent
driver_config:
joyent_image_id: ff86eb8a-a069-11e3-ae0e-4f3c8983a91c
joyent_flavor_id: g3-standard-4-smartos
username: root
ssh_key: <%= ENV['SDC_CLI_IDENTITY'] %>
busser:
ruby_bindir: '/opt/local/bin/'
provisioner:
name: chef_zero
sudo: false
chef_omnibus_url: https://raw.github.com/test-kitchen/kitchen-joyent/master/scripts/install-smartos.sh
- name: omnios-151006
driver_plugin: ec2
driver_config:
image_id: ami-35eb835c
flavor_id: m3.medium
username: root
ssh_key: <%= ENV['EC2_SSH_KEY_PATH'] %>
provisioner:
name: chef_zero
run_list:
- recipe[ips-omniti]
suites:
- name: default
run_list:
- recipe[postfix]
attributes: {}
- name: aliases
run_list:
- recipe[postfix::aliases]
attributes: {}
- name: client
run_list:
- recipe[postfix::client]
attributes: {}
- name: server
run_list:
- recipe[postfix::server]
attributes: {}
- name: sasl_auth
run_list:
- recipe[postfix::sasl_auth]
attributes:
postfix:
main :
smtp_sasl_auth_enable: "yes"

63
.kitchen.docker.yml Normal file
View File

@ -0,0 +1,63 @@
settings:
parallel: true
driver:
name: docker
# privileged is required otherwise the container doesn't boot right
privileged: true
platforms:
- name: centos-7.1
driver:
image: centos:7
platform: rhel
run_command: /usr/lib/systemd/systemd
provision_command:
- /bin/yum install -y initscripts net-tools wget
- name: ubuntu-12.04
driver:
image: ubuntu-upstart:12.04
platform: ubuntu
disable_upstart: false
run_command: /sbin/init
provision_command:
- /usr/bin/apt-get update
- /usr/bin/apt-get install apt-transport-https net-tools -y
- name: ubuntu-14.04
driver:
image: ubuntu-upstart:14.04
platform: ubuntu
disable_upstart: false
run_command: /sbin/init
provision_command:
- /usr/bin/apt-get update
- /usr/bin/apt-get install apt-transport-https net-tools -y
suites:
- name: default
run_list:
- recipe[postfix]
- name: aliases
run_list:
- recipe[postfix::aliases]
- name: client
run_list:
- recipe[postfix::client]
- name: server
run_list:
- recipe[postfix::server]
- name: sasl_auth
run_list:
- recipe[postfix::sasl_auth]
attributes:
postfix:
main:
relayhost: "localhost"
smtp_sasl_auth_enable: "yes"
sasl:
smtp_sasl_user_name: "kitchenuser"
smtp_sasl_passwd: "not-a-real-thing"

View File

@ -7,12 +7,15 @@ provisioner:
platforms:
- name: centos-6.7
- name: centos-7.1
- name: debian-7.8
run_list: apt::default
- name: debian-8.1
run_list: apt::default
- name: fedora-21
- name: ubuntu-12.04
run_list:
- recipe[apt::default]
run_list: apt::default
- name: ubuntu-14.04
run_list:
- recipe[apt::default]
run_list: apt::default
- name: omnios-r151014
driver:
box: omnios-r151014

View File

@ -1,12 +1,32 @@
AllCops:
Exclude:
- vendor/**/*
- Guardfile
- test/**/*
AlignParameters:
Enabled: false
ClassLength:
Enabled: false
CyclomaticComplexity:
Enabled: false
Documentation:
Enabled: false
Encoding:
Enabled: false
Style/FileName:
Enabled: false
LineLength:
Enabled: false
MethodLength:
Enabled: false
Metrics/AbcSize:
Enabled: false
PerceivedComplexity:
Enabled: false
SingleSpaceBeforeFirstArg:
Enabled: false
Style/ClassAndModuleChildren:
Enabled: false
Style/FileName:
Enabled: false

View File

@ -1,12 +1,35 @@
sudo: false
cache: bundler
language: ruby
bundler_args: --without kitchen_common kitchen_vagrant kitchen_cloud
rvm:
- 2.0
- 2.1
- 2.2
sudo: required
# install the pre-release chef-dk. Use chef-stable-precise to install the stable release
addons:
apt:
sources:
- chef-current-precise
packages:
- chefdk
services: docker
env:
matrix:
- INSTANCE=default-ubuntu-1404
- INSTANCE=default-ubuntu-1204
- INSTANCE=default-centos-71
# Don't `bundle install`
install: echo "skip bundle install"
# Ensure we make ChefDK's Ruby the default
before_script:
# https://github.com/zuazo/kitchen-in-travis-native/issues/1#issuecomment-142230889
- sudo iptables -L DOCKER || ( echo "DOCKER iptables chain missing" ; sudo iptables -N DOCKER )
- eval "$(/opt/chefdk/bin/chef shell-init bash)"
- /opt/chefdk/embedded/bin/chef gem install kitchen-docker
script:
- bundle exec foodcritic -f any .
- bundle exec rubocop
- bundle exec rspec --color --format progress
- /opt/chefdk/embedded/bin/chef --version
- /opt/chefdk/embedded/bin/rubocop --version
- /opt/chefdk/embedded/bin/rubocop
- /opt/chefdk/embedded/bin/foodcritic --version
- /opt/chefdk/embedded/bin/foodcritic . --exclude spec
- /opt/chefdk/embedded/bin/rspec
- KITCHEN_LOCAL_YAML=.kitchen.docker.yml /opt/chefdk/embedded/bin/kitchen verify ${INSTANCE}

View File

@ -4,7 +4,6 @@ metadata
group :integration do
cookbook 'apt'
cookbook 'yum'
cookbook 'fake', path: 'test/fixtures/cookbooks/fake'
cookbook 'wrapper', path: 'test/fixtures/cookbooks/wrapper'
end

17
Gemfile
View File

@ -1,13 +1,18 @@
source 'https://rubygems.org'
group :rake do
gem 'rake'
gem 'tomlrb'
end
group :lint do
gem 'foodcritic', '~> 4.0'
gem 'rubocop', '~> 0.33'
gem 'foodcritic', '~> 5.0'
gem 'rubocop', '~> 0.34'
end
group :unit do
gem 'berkshelf', '3.2'
gem 'chefspec', '~> 4.3'
gem 'berkshelf', '~> 4.0'
gem 'chefspec', '~> 4.4'
end
group :kitchen_common do
@ -15,7 +20,7 @@ group :kitchen_common do
end
group :kitchen_vagrant do
gem 'kitchen-vagrant', '~> 0.18'
gem 'kitchen-vagrant', '~> 0.19'
end
group :kitchen_cloud do
@ -32,7 +37,5 @@ group :development do
gem 'guard-foodcritic'
gem 'guard-rspec'
gem 'guard-rubocop'
gem 'rake'
gem 'fauxhai'
gem 'pry-nav'
end

19
MAINTAINERS.md Normal file
View File

@ -0,0 +1,19 @@
<!-- This is a generated file. Please do not edit directly -->
# Maintainers
This file lists how this cookbook project is maintained. When making changes to the system, this
file tells you who needs to review your patch - you need a simple majority of maintainers
for the relevant subsystems to provide a :+1: on your pull request. Additionally, you need
to not receive a veto from a Lieutenant or the Project Lead.
Check out [How Cookbooks are Maintained](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD)
for details on the process and how to become a maintainer or the project lead.
# Project Maintainer
* [Tim Smith](https://github.com/tas50)
# Maintainers
* [Jennifer Davis](https://github.com/sigje)
* [Sean OMeara](https://github.com/someara)
* [Tim Smith](https://github.com/tas50)
* [Thom May](https://github.com/thommay)

46
MAINTAINERS.toml Normal file
View File

@ -0,0 +1,46 @@
#
# This file is structured to be consumed by both humans and computers.
# It is a TOML document containing Markdown
#
[Preamble]
title = "Maintainers"
text = """
This file lists how this cookbook project is maintained. When making changes to the system, this
file tells you who needs to review your patch - you need a simple majority of maintainers
for the relevant subsystems to provide a :+1: on your pull request. Additionally, you need
to not receive a veto from a Lieutenant or the Project Lead.
Check out [How Cookbooks are Maintained](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD)
for details on the process and how to become a maintainer or the project lead.
"""
[Org]
[Org.Components]
[Org.Components.Core]
title = "Project Maintainer"
lieutenant = 'tas50'
maintainers = [
'sigje',
'someara',
'tas50',
'thommay'
]
[people]
[people.sigje]
name = "Jennifer Davis"
github = "sigje"
[people.someara]
name = "Sean OMeara"
github = "someara"
[people.tas50]
name = "Tim Smith"
github = "tas50"
[people.thommay]
name = "Thom May"
github = "thommay"

View File

@ -11,7 +11,7 @@ On RHEL-family systems, sendmail will be replaced with postfix.
Requirements
------------
### Platforms
#### Platforms
- Ubuntu 10.04+
- Debian 6.0+
- RHEL/CentOS/Scientific 5.7+, 6.2+
@ -19,6 +19,12 @@ Requirements
May work on other platforms with or without modification.
#### Chef
- Chef 11+
#### Cookbooks
- none
Attributes
----------
@ -414,11 +420,11 @@ override_attributes(
License & Authors
-----------------
- Author:: Joshua Timberman <joshua@chef.io>
```text
Copyright:: 2009-2015, Chef Software, Inc
**Author:** Cookbook Engineering Team (<cookbooks@chef.io>)
**Copyright:** 2009-2015, Chef Software, Inc.
```
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

61
Rakefile Normal file
View File

@ -0,0 +1,61 @@
require 'rspec/core/rake_task'
require 'rubocop/rake_task'
require 'foodcritic'
require 'kitchen'
require_relative 'tasks/maintainers'
# Style tests. Rubocop and Foodcritic
namespace :style do
desc 'Run Ruby style checks'
RuboCop::RakeTask.new(:ruby)
desc 'Run Chef style checks'
FoodCritic::Rake::LintTask.new(:chef) do |t|
t.options = {
fail_tags: ['any'],
tags: ['~FC005']
}
end
end
desc 'Run all style checks'
task style: ['style:chef', 'style:ruby']
# Rspec and ChefSpec
desc 'Run ChefSpec examples'
RSpec::Core::RakeTask.new(:spec)
# Integration tests. Kitchen.ci
namespace :integration do
desc 'Run Test Kitchen with Vagrant'
task :vagrant do
Kitchen.logger = Kitchen.default_file_logger
Kitchen::Config.new.instances.each do |instance|
instance.test(:always)
end
end
desc 'Run Test Kitchen with cloud plugins'
task :cloud do
run_kitchen = true
if ENV['TRAVIS'] == 'true' && ENV['TRAVIS_PULL_REQUEST'] != 'false'
run_kitchen = false
end
if run_kitchen
Kitchen.logger = Kitchen.default_file_logger
@loader = Kitchen::Loader::YAML.new(project_config: './.kitchen.cloud.yml')
config = Kitchen::Config.new(loader: @loader)
config.instances.each do |instance|
instance.test(:always)
end
end
end
end
desc 'Run all tests on Travis'
task travis: ['style', 'spec', 'integration:cloud']
# Default
task default: ['style', 'spec', 'integration:vagrant']

View File

@ -395,3 +395,7 @@ when 'freebsd'
else
default['postfix']['aliases'] = {}
end
if node['postfix']['use_relay_restirictions_maps']
default['postfix']['main']['smtpd_relay_restrictions'] = "hash:#{node['postfix']['relay_restrictions_db']}, reject"
end

View File

@ -54,6 +54,8 @@ features/*
examples/*
Guardfile
Procfile
test/*
spec/*
# SCM #
#######
@ -95,6 +97,3 @@ Vagrantfile
# Travis #
##########
.travis.yml
test/
spec/
examples/

View File

@ -18,7 +18,7 @@ recipe 'postfix::client', 'Searches for the relayhost based on an attribute'
recipe 'postfix::server', 'Sets the mail_type attribute to master'
recipe 'postfix::maps', 'Manages any number of any type postfix lookup tables'
%w(ubuntu debian redhat centos amazon oracle scientific smartos).each do |os|
%w(ubuntu debian redhat centos amazon oracle scientific smartos fedora).each do |os|
supports os
end

76
tasks/maintainers.rb Normal file
View File

@ -0,0 +1,76 @@
#
# Copyright:: Copyright (c) 2015 Chef Software, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
require 'rake'
SOURCE = File.join(File.dirname(__FILE__), '..', 'MAINTAINERS.toml')
TARGET = File.join(File.dirname(__FILE__), '..', 'MAINTAINERS.md')
begin
require 'tomlrb'
task default: 'maintainers:generate'
namespace :maintainers do
desc 'Generate MarkDown version of MAINTAINERS file'
task :generate do
@toml = Tomlrb.load_file SOURCE
out = "<!-- This is a generated file. Please do not edit directly -->\n\n"
out << preamble
out << project_lieutenant
out << all_maintainers
File.open(TARGET, 'w') do |fn|
fn.write out
end
end
end
rescue LoadError
STDERR.puts "\n*** TomlRb not available.\n\n"
end
private
def preamble
<<-EOL
# #{@toml['Preamble']['title']}
#{@toml['Preamble']['text']}
EOL
end
def project_lieutenant
<<-EOL
# #{@toml['Org']['Components']['Core']['title']}
#{github_link(@toml['Org']['Components']['Core']['lieutenant'])}
EOL
end
def all_maintainers
text = "# Maintainers\n"
@toml['Org']['Components']['Core']['maintainers'].each do |m|
text << "#{github_link(m)}\n"
end
text
end
def github_link(person)
name = @toml['people'][person]['name']
github = @toml['people'][person]['github']
"* [#{name}](https://github.com/#{github})"
end

View File

@ -1,8 +1,5 @@
default['postfix']['main']['smtp_sasl_auth_enable'] = 'yes'
default['postfix']['main']['relayhost'] = 'please'
default['postfix']['main']['smtp_sasl_security_options'] = 'keep'
default['postfix']['sasl']['smtp_sasl_user_name'] = 'us'
default['postfix']['sasl']['smtp_sasl_passwd'] = 'happy'
default['postfix']['sasl']['smtp_sasl_user_name'] = 'keep'
default['postfix']['sasl']['smtp_sasl_passwd'] = 'us'
default['postfix']['sender_canonical_map_entries'] = {}

View File

@ -1,2 +1 @@
include_recipe 'postfix'

View File

@ -7,7 +7,7 @@ def which_family
fam = 'solaris2'
return fam unless File.exist? '/etc/release'
File.open('/etc/release') do |file|
while (line = file.gets)
while line = file.gets
case line
when /^\s*(OmniOS)/
fam = 'omnios'