From 4667cdfc1ef29cb3cd0b79f45a2410f590dd6f84 Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Tue, 17 Jan 2017 23:36:22 -0800 Subject: [PATCH] Testing updates Signed-off-by: Tim Smith --- .kitchen.docker.yml | 13 ++----------- .kitchen.yml | 3 ++- .travis.yml | 15 ++++++--------- MAINTAINERS.md | 9 +++------ MAINTAINERS.toml | 11 ++++------- README.md | 43 +++++++++++++++++++++++++------------------ Rakefile | 12 ++++++------ metadata.rb | 3 +-- spec/spec_helper.rb | 6 ++++++ 9 files changed, 55 insertions(+), 60 deletions(-) diff --git a/.kitchen.docker.yml b/.kitchen.docker.yml index 9b8c2de..7f535d4 100644 --- a/.kitchen.docker.yml +++ b/.kitchen.docker.yml @@ -1,7 +1,6 @@ driver: name: dokken privileged: true # because Docker and SystemD/Upstart - chef_image: chef/chef chef_version: current transport: @@ -31,14 +30,6 @@ platforms: - RUN /usr/bin/apt-get update - RUN /usr/bin/apt-get install lsb-release -y -- name: centos-5 - driver: - image: centos:5 - platform: rhel - pid_one_command: /sbin/init - intermediate_instructions: - - RUN yum install -y which initscripts - - name: centos-6 driver: image: centos:6 @@ -90,9 +81,9 @@ platforms: intermediate_instructions: - RUN zypper --non-interactive install aaa_base perl-Getopt-Long-Descriptive which net-tools -- name: opensuse-42.1 +- name: opensuse-leap driver: - image: opensuse:42.1 + image: opensuse:leap pid_one_command: /bin/systemd intermediate_instructions: - RUN zypper --non-interactive install aaa_base perl-Getopt-Long-Descriptive which hostname diff --git a/.kitchen.yml b/.kitchen.yml index b363ff6..d1ea7c6 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -5,7 +5,6 @@ provisioner: name: chef_zero platforms: - - name: centos-5.11 - name: centos-6.8 - name: centos-7.2 - name: debian-7.11 @@ -14,6 +13,8 @@ platforms: run_list: apt::default - name: fedora-25 run_list: yum::dnf_yum_compat + - name: opensuse-13.2 + - name: opensuse-leap-42.1 - name: ubuntu-12.04 run_list: apt::default - name: ubuntu-14.04 diff --git a/.travis.yml b/.travis.yml index bdd0e0e..72e9a81 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ sudo: required dist: trusty -# install the pre-release chef-dk. Use chef-stable-precise to install the stable release +# install the pre-release chef-dk. Use chef-stable-trusty to install the stable release addons: apt: sources: @@ -20,26 +20,23 @@ services: docker env: matrix: + - INSTANCE=default-centos-6 + - INSTANCE=default-centos-7 - INSTANCE=default-ubuntu-1204 - INSTANCE=default-ubuntu-1404 - INSTANCE=default-ubuntu-1604 - - INSTANCE=default-centos-5 - - INSTANCE=default-centos-6 - - INSTANCE=default-centos-7 before_script: - 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 --version + - /opt/chefdk/embedded/bin/cookstyle --version + - /opt/chefdk/embedded/bin/foodcritic --version script: KITCHEN_LOCAL_YAML=.kitchen.docker.yml /opt/chefdk/embedded/bin/kitchen verify ${INSTANCE} matrix: include: - - before_script: - - eval "$(/opt/chefdk/bin/chef shell-init bash)" - - /opt/chefdk/embedded/bin/chef --version - - /opt/chefdk/embedded/bin/cookstyle --version - - /opt/chefdk/embedded/bin/foodcritic --version - script: - /opt/chefdk/bin/chef exec rake env: UNIT_AND_LINT=1 diff --git a/MAINTAINERS.md b/MAINTAINERS.md index c8f99e2..645ed14 100644 --- a/MAINTAINERS.md +++ b/MAINTAINERS.md @@ -1,13 +1,10 @@ # 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 review from an existing maintainer -for the cookbook 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. +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 review from an existing maintainer for the cookbook 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) diff --git a/MAINTAINERS.toml b/MAINTAINERS.toml index e56145b..6bb35d6 100644 --- a/MAINTAINERS.toml +++ b/MAINTAINERS.toml @@ -5,13 +5,10 @@ [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 review from an existing maintainer -for the cookbook 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. +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 review from an existing maintainer for the cookbook 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] @@ -20,7 +17,7 @@ for details on the process and how to become a maintainer or the project lead. title = "Project Maintainer" lieutenant = 'tas50' - + maintainers = [ 'sigje', 'tas50', diff --git a/README.md b/README.md index 4141c4a..321b1c2 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ -postfix Cookbook -================ +# postfix Cookbook [![Build Status](https://travis-ci.org/chef-cookbooks/postfix.svg?branch=master)](https://travis-ci.org/chef-cookbooks/postfix) [![Cookbook Version](https://img.shields.io/cookbook/v/postfix.svg)](https://supermarket.chef.io/cookbooks/postfix) @@ -8,10 +7,10 @@ Installs and configures postfix for client or outbound relayhost, or to do SASL On RHEL-family systems, sendmail will be replaced with postfix. +## Requirements + +### Platforms -Requirements ------------- -#### Platforms - Ubuntu 12.04+ - Debian 7.0+ - RHEL/CentOS/Scientific 5.7+, 6.2+ @@ -19,15 +18,17 @@ Requirements May work on other platforms with or without modification. -#### Chef +### Chef + - Chef 12.1+ -#### Cookbooks +### Cookbooks + - none -Attributes ----------- +## Attributes + See `attributes/default.rb` for default values. ### Generic cookbook attributes @@ -93,14 +94,16 @@ Example of json role config, for setup *_map_entries: * `node['postfix']['master']['submission'] - Whether to use submission (TCP 587) daemon. (true/false); default false -Recipes -------- +## Recipes + ### default + Installs the postfix package and manages the service and the main configuration files (`/etc/postfix/main.cf` and `/etc/postfix/master.cf`). See __Usage__ and __Examples__ to see how to affect behavior of this recipe through configuration. Depending on the `node['postfix']['use_alias_maps']`, `node['postfix']['use_transport_maps']`, `node['postfix']['use_access_maps']` and `node['postfix']['use_virtual_aliases']` attributes the default recipe can call additional recipes to manage additional postfix configuration files For a more dynamic approach to discovery for the relayhost, see the `client` and `server` recipes below. ### client + Use this recipe to have nodes automatically search for the mail relay based which node has the `node['postfix']['relayhost_role']` role. Sets the `node['postfix']['main']['relayhost']` attribute to the first result from the search. Includes the default recipe to install, configure and start postfix. @@ -108,31 +111,35 @@ Includes the default recipe to install, configure and start postfix. Does not work with `chef-solo`. ### sasl\_auth + Sets up the system to authenticate with a remote mail relay using SASL authentication. ### server + To use Chef Server search to automatically detect a node that is the relayhost, use this recipe in a role that will be relayhost. By default, the role should be "relayhost" but you can change the attribute `node['postfix']['relayhost_role']` to modify this. **Note** This recipe will set the `node['postfix']['mail_type']` to "master" with an override attribute. ### aliases + Manage `/etc/aliases` with this recipe. Currently only Ubuntu 10.04 platform has a template for the aliases file. Add your aliases template to the `templates/default` or to the appropriate platform+version directory per the File Specificity rules for templates. Then specify a hash of aliases for the `node['postfix']['aliases']` attribute. Arrays are supported as alias values, since postfix supports comma separated values per alias, simply specify your alias as an array to use this handy feature. -### aliases -Manage `/etc/aliases` with this recipe. - ### transports + Manage `/etc/postfix/transport` with this recipe. ### access + Manage `/etc/postfix/access` with this recipe. ### virtual_aliases + Manage `/etc/postfix/virtual` with this recipe. ### relay_restrictions + Manage `/etc/postfix/relay_restriction` with this recipe The postfix option smtpd_relay_restrictions in main.cf will point to this hash map db. @@ -140,8 +147,8 @@ The postfix option smtpd_relay_restrictions in main.cf will point to this hash m http://wiki.chef.io/display/chef/Templates#Templates-TemplateLocationSpecificity -Usage ------ +## Usage + On systems that should simply send mail directly to a relay, or out to the internet, use `recipe[postfix]` and modify the `node['postfix']['main']['relayhost']` attribute via a role. On systems that should be the MX for a domain, set the attributes accordingly and make sure the `node['postfix']['mail_type']` attribute is `master`. See __Examples__ for information on how to use `recipe[postfix::server]` to do this automatically. @@ -152,6 +159,7 @@ For each of these implementations, see __Examples__ for role usage. ### Examples + The example roles below only have the relevant postfix usage. You may have other contents depending on what you're configuring on your systems. The `base` role is applied to all nodes in the environment. @@ -298,8 +306,7 @@ override_attributes( ) ``` -License & Authors ------------------ +## License & Authors **Author:** Cookbook Engineering Team () diff --git a/Rakefile b/Rakefile index e0c18d2..f810d23 100644 --- a/Rakefile +++ b/Rakefile @@ -11,7 +11,7 @@ namespace :style do desc 'Run Ruby style checks' RuboCop::RakeTask.new(:ruby) rescue LoadError => e - puts ">>> Gem load error: #{e}, omitting style:ruby" unless ENV['CI'] + puts ">>> Gem load error: #{e}, omitting #{task.name}" unless ENV['CI'] end begin @@ -24,8 +24,8 @@ namespace :style do progress: true, } end - rescue LoadError - puts ">>> Gem load error: #{e}, omitting style:chef" unless ENV['CI'] + rescue LoadError => e + puts ">>> Gem load error: #{e}, omitting #{task.name}" unless ENV['CI'] end end @@ -39,7 +39,7 @@ begin desc 'Run ChefSpec examples' RSpec::Core::RakeTask.new(:spec) rescue LoadError => e - puts ">>> Gem load error: #{e}, omitting spec" unless ENV['CI'] + puts ">>> Gem load error: #{e}, omitting #{task.name}" unless ENV['CI'] end # Integration tests. Kitchen.ci @@ -49,8 +49,8 @@ namespace :integration do desc 'Run kitchen integration tests' Kitchen::RakeTasks.new - rescue StandardError => e - puts ">>> Kitchen error: #{e}, omitting #{task.name}" unless ENV['CI'] + rescue LoadError, StandardError => e + puts ">>> Gem load error: #{e}, omitting #{task.name}" unless ENV['CI'] end end diff --git a/metadata.rb b/metadata.rb index 66e3111..dbf6dfe 100644 --- a/metadata.rb +++ b/metadata.rb @@ -21,5 +21,4 @@ end source_url 'https://github.com/chef-cookbooks/postfix' issues_url 'https://github.com/chef-cookbooks/postfix/issues' - -chef_version '>= 12.1' +chef_version '>= 12.1' if respond_to?(:chef_version) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 1dd5126..773d557 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,2 +1,8 @@ require 'chefspec' require 'chefspec/berkshelf' + +RSpec.configure do |config| + config.color = true # Use color in STDOUT + config.formatter = :documentation # Use the specified formatter + config.log_level = :error # Avoid deprecation notice SPAM +end