Commit 079ed172 authored by David Hollinger III's avatar David Hollinger III Committed by GitHub

Merge pull request #877 from voxpupuli/modulesync

modulesync 1.9.3
parents a966a779 72dc088b
This module has grown over time based on a range of contributions from
people using it. If you follow these contributing guidelines your patch
will likely make it into a release a little more quickly.
## Contributing
Please note that this project is released with a Contributor Code of Conduct.
By participating in this project you agree to abide by its terms.
[Contributor Code of Conduct](https://voxpupuli.org/coc/).
1. Fork the repo.
1. Create a separate branch for your change.
1. Run the tests. We only take pull requests with passing tests, and
documentation.
1. Add a test for your change. Only refactoring and documentation
changes require no new tests. If you are adding functionality
or fixing a bug, please add a test.
1. Squash your commits down into logical components. Make sure to rebase
against the current master.
1. Push the branch to your fork and submit a pull request.
Please be prepared to repeat some of these steps as our contributors review
your code.
## Dependencies
The testing and development tools have a bunch of dependencies,
all managed by [bundler](http://bundler.io/) according to the
[Puppet support matrix](http://docs.puppetlabs.com/guides/platforms.html#ruby-versions).
By default the tests use a baseline version of Puppet.
If you have Ruby 2.x or want a specific version of Puppet,
you must set an environment variable such as:
export PUPPET_VERSION="~> 4.2.0"
You can install all needed gems for spec tests into the modules directory by
running:
```sh
bundle install --path .vendor/ --without development --without system_tests --without release
```
If you also want to run acceptance tests:
```sh
bundle install --path .vendor/ --without development --with system_tests --without release
```
Our all in one solution if you don't know if you need to install or update gems:
```sh
bundle install --path .vendor/ --without development --with system_tests --without release; bundle update; bundle clean
```
## Syntax and style
The test suite will run [Puppet Lint](http://puppet-lint.com/) and
[Puppet Syntax](https://github.com/gds-operations/puppet-syntax) to
check various syntax and style things. You can run these locally with:
bundle exec rake lint
bundle exec rake validate
It will also run some [Rubocop](http://batsov.com/rubocop/) tests
against it. You can run those locally ahead of time with:
bundle exec rake rubocop
## Running the unit tests
The unit test suite covers most of the code, as mentioned above please
add tests if you're adding new functionality. If you've not used
[rspec-puppet](http://rspec-puppet.com/) before then feel free to ask
about how best to test your new feature.
To run the linter, the syntax checker and the unit tests:
bundle exec rake test
To run your all the unit tests
bundle exec rake spec SPEC_OPTS='--format documentation'
To run a specific spec test set the `SPEC` variable:
bundle exec rake spec SPEC=spec/foo_spec.rb
## Integration tests
The unit tests just check the code runs, not that it does exactly what
we want on a real machine. For that we're using
[beaker](https://github.com/puppetlabs/beaker).
This fires up a new virtual machine (using vagrant) and runs a series of
simple tests against it after applying the module. You can run this
with:
bundle exec rake acceptance
This will run the tests on the module's default nodeset. You can override the
nodeset used, e.g.,
BEAKER_set=centos-7-x64 bundle exec rake acceptance
There are default rake tasks for the various acceptance test modules, e.g.,
bundle exec rake beaker:centos-7-x64
bundle exec rake beaker:ssh:centos-7-x64
If you don't want to have to recreate the virtual machine every time you can
use `BEAKER_destroy=no` and `BEAKER_provision=no`. On the first run you will at
least need `BEAKER_provision` set to yes (the default). The Vagrantfile for the
created virtual machines will be in `.vagrant/beaker_vagrant_files`.
The easiest way to debug in a docker container is to open a shell:
docker exec -it -u root ${container_id_or_name} bash
<!--
Thank you for contributing to this project!
- This project has a Contributor Code of Conduct: https://voxpupuli.org/coc/
- Please check that here is no existing issue or PR that addresses your problem.
- Please fill the following form to enable us to help you.
- Our vulnerabilities reporting process is at https://voxpupuli.org/security/
-->
## Affected Puppet, Ruby, OS and module versions/distributions
- Puppet:
- Ruby:
- Distribution:
- Module version:
## How to reproduce (e.g Puppet code you use)
## What are you seeing
## What behaviour did you expect instead
## Output log
## Any additional information you'd like to impart
<!--
Thank you for contributing to this project!
- This project has a Contributor Code of Conduct: https://voxpupuli.org/coc/
- Please check that here is no existing issue or PR that addresses your problem.
- Our vulnerabilities reporting process is at https://voxpupuli.org/security/
-->
#### Pull Request (PR) description
<!--
Replace this comment with a description of your pull request.
-->
#### This Pull Request (PR) fixes the following issues
<!--
Replace this comment with the list of issues or n/a.
Use format:
Fixes #123
Fixes #124
-->
.blimpy.d
.bundle
doc/
pkg/
Gemfile.lock
.idea
Gemfile.local
vendor/
.vendor/
spec/fixtures/manifests/
spec/fixtures/modules/
.vagrant/
.bundle/
.ruby-version
coverage/
log/
pkg/*
.project
README.pdf
.ruby-*
.rvmrc
spec/fixtures
*.sw*
/test_reports
tmp/*
.vagrant
.vagrant*
.yardoc
.idea/
.dependencies/
.librarian/
Puppetfile.lock
*.iml
.*.sw?
.yardoc/
Guardfile
modulesync_config_version: '1.9.3-rc0'
# Managed by https://github.com/voxpupuli/modulesync_configs
#
# Hooks are only enabled if you take action.
#
# To enable the hooks run:
#
# ```
# bundle exec overcommit --install
# # ensure .overcommit.yml does not harm to you and then
# bundle exec overcommit --sign
# ```
#
# (it will manage the .git/hooks directory):
#
# Examples howto skip a test for a commit or push:
#
# ```
# SKIP=RuboCop git commit
# SKIP=PuppetLint git commit
# SKIP=RakeTask git push
# ```
#
# Don't invoke overcommit at all:
#
# ```
# OVERCOMMIT_DISABLE=1 git commit
# ```
#
# Read more about overcommit: https://github.com/brigade/overcommit
#
# To manage this config yourself in your module add
#
# ```
# .overcommit.yml:
# unmanaged: true
# ```
#
# to your modules .sync.yml config
---
PreCommit:
RuboCop:
enabled: true
description: 'Runs rubocop on modified files only'
command: ['bundle', 'exec', 'rubocop']
PuppetLint:
enabled: true
description: 'Runs puppet-lint on modified files only'
command: ['bundle', 'exec', 'puppet-lint']
YamlSyntax:
enabled: true
JsonSyntax:
enabled: true
TrailingWhitespace:
enabled: true
PrePush:
RakeTarget:
enabled: true
description: 'Run rake targets'
targets:
- 'test'
- 'rubocop'
command: [ 'bundle', 'exec', 'rake' ]
docs/
pkg/
Gemfile.lock
Gemfile.local
vendor/
.vendor/
spec/fixtures/manifests/
spec/fixtures/modules/
.vagrant/
.bundle/
.ruby-version
coverage/
log/
.idea/
.dependencies/
.librarian/
Puppetfile.lock
*.iml
.*.sw?
.yardoc/
--format progress
--format ParallelTests::RSpec::RuntimeLogger --out tmp/parallel_runtime_rspec.log
--order random
inherit_from: .rubocop_todo.yml
require: rubocop-rspec
AllCops:
TargetRubyVersion: 1.9
......@@ -14,7 +13,6 @@ AllCops:
- Rakefile
- Guardfile
- Vagrantfile
- lib/puppet/jenkins/okjson.rb
Lint/ConditionPosition:
Enabled: True
......
---
.travis.yml:
secure: "cQdjbcwx+q/ArSkOtnxMYmlsWnJmyNEz7IUmpSx3F/z1ntX75/J3mJYFgYuvrOw2IbmmuwgVPofBpJjJajkhGOpaywOjKA6PgxKzSEu6e/q5CXJwMLnsDhHqY6X9bdGF5TU/DUkNzxBQlI7uDyk3yBVAACzLGMTCFksoztdlIbI="
docker_sets:
- set: docker/ubuntu-14.04
- set: docker/ubuntu-16.04
- set: docker/centos-7
......@@ -34,12 +34,25 @@ matrix:
env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/centos-7 CHECK=beaker
services: docker
sudo: required
allow_failures:
- env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/centos-7 CHECK=beaker
- env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/ubuntu-16.04 CHECK=beaker
branches:
only:
- master
- /^v\d/
notifications:
email: false
irc:
on_success: always
on_failure: always
channels:
- "chat.freenode.org#voxpupuli-notifications"
deploy:
provider: puppetforge
user: puppet
password:
secure: "cQdjbcwx+q/ArSkOtnxMYmlsWnJmyNEz7IUmpSx3F/z1ntX75/J3mJYFgYuvrOw2IbmmuwgVPofBpJjJajkhGOpaywOjKA6PgxKzSEu6e/q5CXJwMLnsDhHqY6X9bdGF5TU/DUkNzxBQlI7uDyk3yBVAACzLGMTCFksoztdlIbI="
on:
tags: true
# all_branches is required to use tags
all_branches: true
# Only publish the build marked with "DEPLOY_TO_FORGE"
condition: "$DEPLOY_TO_FORGE = yes"
--markup markdown
--output-dir docs/
---
# This file is managed via modulesync
# https://github.com/voxpupuli/modulesync
# https://github.com/voxpupuli/modulesync_config
HOSTS:
archlinux-2-x64:
roles:
- master
platform: archlinux-2-x64
box: archlinux/archlinux
hypervisor: vagrant
CONFIG:
type: foss
---
# This file is managed via modulesync
# https://github.com/voxpupuli/modulesync
# https://github.com/voxpupuli/modulesync_config
HOSTS:
centos-6-x64:
roles:
- master
platform: el-6-x86_64
box: centos/6
hypervisor: vagrant
CONFIG:
type: aio
...
# vim: syntax=yaml
---
# This file is managed via modulesync
# https://github.com/voxpupuli/modulesync
# https://github.com/voxpupuli/modulesync_config
HOSTS:
centos-66-x64:
roles:
- master
- database
- dashboard
platform: el-6-x86_64
box: puppetlabs/centos-6.6-64-puppet-enterprise
hypervisor: vagrant
CONFIG:
type: pe
...
# vim: syntax=yaml
---
# This file is managed via modulesync
# https://github.com/voxpupuli/modulesync
# https://github.com/voxpupuli/modulesync_config
HOSTS:
centos-7-x64:
roles:
- master
platform: el-7-x86_64
box: centos/7
hypervisor: vagrant
CONFIG:
type: aio
...
# vim: syntax=yaml
---
# This file is managed via modulesync
# https://github.com/voxpupuli/modulesync
# https://github.com/voxpupuli/modulesync_config
HOSTS:
debian-82-x64:
roles:
- master
platform: debian-8-amd64
box: puppetlabs/debian-8.2-64-nocm
hypervisor: vagrant
CONFIG:
type: foss
...
# vim: syntax=yaml
---
# This file is managed via modulesync
# https://github.com/voxpupuli/modulesync
# https://github.com/voxpupuli/modulesync_config
#
# Additional ~/.fog config file with AWS EC2 credentials
# required.
#
# see: https://github.com/puppetlabs/beaker/blob/master/docs/how_to/hypervisors/ec2.md
#
# Amazon Linux is not a RHEL clone.
#
HOSTS:
amazonlinux-2016091-x64:
roles:
- master
platform: centos-6-x86_64
hypervisor: ec2
# refers to image_tempaltes.yaml AMI[vmname] entry:
vmname: amazonlinux-2016091-eu-central-1
# refers to image_tempaltes.yaml entry inside AMI[vmname][:image]:
snapshot: aio
# t2.micro is free tier eligible (https://aws.amazon.com/en/free/):
amisize: t2.micro
# required so that beaker sanitizes sshd_config and root authorized_keys:
user: ec2-user
CONFIG:
type: aio
:ec2_yaml: spec/acceptance/nodesets/ec2/image_templates.yaml
...
# vim: syntax=yaml
# This file is managed via modulesync
# https://github.com/voxpupuli/modulesync
# https://github.com/voxpupuli/modulesync_config
#
# see also: https://github.com/puppetlabs/beaker/blob/master/docs/how_to/hypervisors/ec2.md
#
# Hint: image IDs (ami-*) for the same image are different per location.
#
AMI:
# Amazon Linux AMI 2016.09.1 (HVM), SSD Volume Type
amazonlinux-2016091-eu-central-1:
:image:
:aio: ami-af0fc0c0
:region: eu-central-1
# Red Hat Enterprise Linux 7.3 (HVM), SSD Volume Type
rhel-73-eu-central-1:
:image:
:aio: ami-e4c63e8b
:region: eu-central-1
# SUSE Linux Enterprise Server 12 SP2 (HVM), SSD Volume Type
sles-12sp2-eu-central-1:
:image:
:aio: ami-c425e4ab
:region: eu-central-1
# Ubuntu Server 16.04 LTS (HVM), SSD Volume Type
ubuntu-1604-eu-central-1:
:image:
:aio: ami-fe408091
:region: eu-central-1
# Microsoft Windows Server 2016 Base
windows-2016-base-eu-central-1:
:image:
:aio: ami-88ec20e7
:region: eu-central-1
---
# This file is managed via modulesync
# https://github.com/voxpupuli/modulesync
# https://github.com/voxpupuli/modulesync_config
#
# Additional ~/.fog config file with AWS EC2 credentials
# required.
#
# see: https://github.com/puppetlabs/beaker/blob/master/docs/how_to/hypervisors/ec2.md
#
HOSTS:
rhel-73-x64:
roles:
- master
platform: el-7-x86_64
hypervisor: ec2
# refers to image_tempaltes.yaml AMI[vmname] entry:
vmname: rhel-73-eu-central-1
# refers to image_tempaltes.yaml entry inside AMI[vmname][:image]:
snapshot: aio
# t2.micro is free tier eligible (https://aws.amazon.com/en/free/):
amisize: t2.micro
# required so that beaker sanitizes sshd_config and root authorized_keys:
user: ec2-user
CONFIG:
type: aio
:ec2_yaml: spec/acceptance/nodesets/ec2/image_templates.yaml
...
# vim: syntax=yaml
---
# This file is managed via modulesync
# https://github.com/voxpupuli/modulesync
# https://github.com/voxpupuli/modulesync_config
#
# Additional ~/.fog config file with AWS EC2 credentials
# required.
#
# see: https://github.com/puppetlabs/beaker/blob/master/docs/how_to/hypervisors/ec2.md
#
HOSTS:
sles-12sp2-x64:
roles:
- master
platform: sles-12-x86_64
hypervisor: ec2
# refers to image_tempaltes.yaml AMI[vmname] entry:
vmname: sles-12sp2-eu-central-1
# refers to image_tempaltes.yaml entry inside AMI[vmname][:image]:
snapshot: aio
# t2.micro is free tier eligible (https://aws.amazon.com/en/free/):
amisize: t2.micro
# required so that beaker sanitizes sshd_config and root authorized_keys:
user: ec2-user
CONFIG:
type: aio
:ec2_yaml: spec/acceptance/nodesets/ec2/image_templates.yaml
...
# vim: syntax=yaml
---
# This file is managed via modulesync
# https://github.com/voxpupuli/modulesync
# https://github.com/voxpupuli/modulesync_config
#
# Additional ~/.fog config file with AWS EC2 credentials
# required.
#
# see: https://github.com/puppetlabs/beaker/blob/master/docs/how_to/hypervisors/ec2.md
#
HOSTS:
ubuntu-1604-x64:
roles:
- master
platform: ubuntu-16.04-amd64
hypervisor: ec2
# refers to image_tempaltes.yaml AMI[vmname] entry:
vmname: ubuntu-1604-eu-central-1
# refers to image_tempaltes.yaml entry inside AMI[vmname][:image]:
snapshot: aio
# t2.micro is free tier eligible (https://aws.amazon.com/en/free/):
amisize: t2.micro
# required so that beaker sanitizes sshd_config and root authorized_keys:
user: ubuntu
CONFIG:
type: aio
:ec2_yaml: spec/acceptance/nodesets/ec2/image_templates.yaml
...
# vim: syntax=yaml
---
# This file is managed via modulesync
# https://github.com/voxpupuli/modulesync
# https://github.com/voxpupuli/modulesync_config
#
# Additional ~/.fog config file with AWS EC2 credentials
# required.
#
# see: https://github.com/puppetlabs/beaker/blob/master/docs/how_to/hypervisors/ec2.md
#
HOSTS:
windows-2016-base-x64:
roles:
- master
platform: windows-2016-64
hypervisor: ec2
# refers to image_tempaltes.yaml AMI[vmname] entry:
vmname: windows-2016-base-eu-central-1
# refers to image_tempaltes.yaml entry inside AMI[vmname][:image]:
snapshot: aio
# t2.micro is free tier eligible (https://aws.amazon.com/en/free/):
amisize: t2.micro
# required so that beaker sanitizes sshd_config and root authorized_keys:
user: ec2-user
CONFIG:
type: aio
:ec2_yaml: spec/acceptance/nodesets/ec2/image_templates.yaml
...
# vim: syntax=yaml
---
# This file is managed via modulesync
# https://github.com/voxpupuli/modulesync
# https://github.com/voxpupuli/modulesync_config
#
HOSTS:
fedora-25-x64:
roles:
- master
platform: fedora-25-x86_64
box: fedora/25-cloud-base
hypervisor: vagrant
CONFIG:
type: aio
...
# vim: syntax=yaml
---
# This file is managed via modulesync
# https://github.com/voxpupuli/modulesync
# https://github.com/voxpupuli/modulesync_config
#
HOSTS:
fedora-26-x64:
roles:
- master
platform: fedora-26-x86_64
box: fedora/26-cloud-base
hypervisor: vagrant
CONFIG:
type: aio
...
# vim: syntax=yaml
---
# This file is managed via modulesync
# https://github.com/voxpupuli/modulesync
# https://github.com/voxpupuli/modulesync_config
#
# platform is fedora 26 because there is no puppet-agent
# for fedora 27 as of 2017-11-17
HOSTS:
fedora-27-x64:
roles:
- master
platform: fedora-26-x86_64
box: fedora/27-cloud-base
hypervisor: vagrant
CONFIG:
type: aio
...
# vim: syntax=yaml
---
# This file is managed via modulesync
# https://github.com/voxpupuli/modulesync
# https://github.com/voxpupuli/modulesync_config
HOSTS:
ubuntu-server-1404-x64:
roles:
- master
platform: ubuntu-14.04-amd64
box: puppetlabs/ubuntu-14.04-64-nocm
hypervisor: vagrant
CONFIG:
type: foss
...
# vim: syntax=yaml
---
# This file is managed via modulesync
# https://github.com/voxpupuli/modulesync
# https://github.com/voxpupuli/modulesync_config
HOSTS:
ubuntu-server-1604-x64:
roles:
- master
platform: ubuntu-16.04-amd64
box: puppetlabs/ubuntu-16.04-64-nocm
hypervisor: vagrant
CONFIG:
type: foss
...
# vim: syntax=yaml
require 'rspec-puppet'
at_exit { RSpec::Puppet::Coverage.report! }
# vim: syntax=ruby
# This file is managed via modulesync
# https://github.com/voxpupuli/modulesync
# https://github.com/voxpupuli/modulesync_config
#
# use default_module_facts.yaml for module specific
# facts.
#
# Hint if using with rspec-puppet-facts ("on_supported_os.each"):
# if a same named fact exists in facterdb it will be overridden.
---
concat_basedir: "/tmp"
ipaddress: "172.16.254.254"
is_pe: false
macaddress: "AA:AA:AA:AA:AA:AA"
require 'rspec'
require 'rspec/its'
require 'puppetlabs_spec_helper/module_spec_helper'
require 'rspec-puppet-facts'
include RspecPuppetFacts
ENV['STRICT_VARIABLES'] = 'no'
# This file is managed via modulesync
# https://github.com/voxpupuli/modulesync