Showing with 1,928 additions and 1 deletion.
  1. +6 −0 .fixtures.yml
  2. +9 −0 .gitignore
  3. +2 −0 .rspec
  4. +17 −0 .travis.yml
  5. +7 −0 CHANGELOG.md
  6. +92 −0 CONTRIBUTING.md
  7. +16 −0 Gemfile
  8. +13 −0 LICENSE
  9. +87 −0 README.markdown
  10. +0 −1 README.md
  11. +62 −0 Rakefile
  12. +12 −0 examples/init.pp
  13. 0 files/.gitkeep
  14. +30 −0 files/RPM-GPG-KEY-puppetlabs
  15. +30 −0 lib/facter/mco_config.rb
  16. +13 −0 lib/facter/settings.rb
  17. +6 −0 manifests/config.pp
  18. +38 −0 manifests/init.pp
  19. +10 −0 manifests/install.pp
  20. +41 −0 manifests/osfamily/redhat.pp
  21. +39 −0 manifests/params.pp
  22. +169 −0 manifests/prepare.pp
  23. +16 −0 manifests/service.pp
  24. +32 −0 metadata.json
  25. +170 −0 spec/acceptance/class_spec.rb
  26. BIN spec/acceptance/files/activemq.keystore
  27. BIN spec/acceptance/files/activemq.truststore
  28. +182 −0 spec/acceptance/files/activemq.xml
  29. +32 −0 spec/acceptance/files/ca_crt.pem
  30. +24 −0 spec/acceptance/files/client.cfg
  31. +32 −0 spec/acceptance/files/client.crt
  32. +51 −0 spec/acceptance/files/client.key
  33. +26 −0 spec/acceptance/files/server.cfg
  34. +32 −0 spec/acceptance/files/server.crt
  35. +51 −0 spec/acceptance/files/server.key
  36. +13 −0 spec/acceptance/nodesets/centos-511-x64.yml
  37. +13 −0 spec/acceptance/nodesets/centos-66-x64.yml
  38. +13 −0 spec/acceptance/nodesets/centos-7-x64.yml
  39. +13 −0 spec/acceptance/nodesets/debian-609-x64.yml
  40. +13 −0 spec/acceptance/nodesets/debian-76-x64.yml
  41. +22 −0 spec/acceptance/nodesets/default.yml
  42. +13 −0 spec/acceptance/nodesets/fedora-20-x64.yml
  43. +13 −0 spec/acceptance/nodesets/ubuntu-1204-x64.yml
  44. +13 −0 spec/acceptance/nodesets/ubuntu-1404-x64.yml
  45. +1 −0 spec/classes/coverage_spec.rb
  46. +42 −0 spec/classes/puppet_agent_osfamily_redhat_spec.rb
  47. +169 −0 spec/classes/puppet_agent_prepare_spec.rb
  48. +63 −0 spec/classes/puppet_agent_spec.rb
  49. +3 −0 spec/spec_helper.rb
  50. +158 −0 spec/spec_helper_acceptance.rb
  51. +19 −0 spec/unit/facter/settings_spec.rb
  52. 0 templates/.gitkeep
6 changes: 6 additions & 0 deletions .fixtures.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
fixtures:
repositories:
stdlib: "https://github.com/puppetlabs/puppetlabs-stdlib.git"
inifile: "https://github.com/puppetlabs/puppetlabs-inifile.git"
symlinks:
puppet_agent: "#{source_dir}"
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.*.sw?
pkg
spec/fixtures
.rspec_system
.vagrant
.bundle
vendor
log
tmp
2 changes: 2 additions & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--format documentation
--color
17 changes: 17 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
language: ruby
bundler_args: --without system_tests
before_install: rm Gemfile.lock || true
script: bundle exec rake test
matrix:
include:
- rvm: 1.8.7
env: PUPPET_VERSION="~> 3.7.5"
- rvm: 1.8.7
env: PUPPET_VERSION="~> 3.8.1"
- rvm: 1.9.3
env: PUPPET_VERSION="~> 3.8.1"
- rvm: 2.0.0
env: PUPPET_VERSION="~> 3.8.1"
- rvm: 2.1.6
env: PUPPET_VERSION="~> 4.0.0"
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Change Log
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [0.1.0] - 2015-06-02
### Added
- Initial release of puppetlabs-puppet_agent, supporting Redhat and Centos 5/6/7.
92 changes: 92 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
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 quicker.


## Contributing

1. Fork the repo.

2. Run the tests. We only take pull requests with passing tests, and
it's great to know that you have a clean slate.

3. 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.

4. Make the test pass.

5. Push to your fork and submit a pull request.


## 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="~> 3.2.0"

Install the dependencies like so...

bundle install

## 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 syntax

## 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. Running the test suite is done
with:

bundle exec rake spec

Note also you can run the syntax, style and unit tests in one go with:

bundle exec rake test

### Automatically run the tests

During development of your puppet module you might want to run your unit
tests a couple of times. You can use the following command to automate
running the unit tests on every change made in the manifests folder.

bundle exec guard

## 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).

Beaker fires up a new virtual machine (using Vagrant) and runs a series of
simple tests against it after applying the module. You can run our
Beaker tests with:

bundle exec rake acceptance

This will use the host described in `spec/acceptance/nodeset/default.yml`
by default. To run against another host, set the `BEAKER_set` environment
variable to the name of a host described by a `.yml` file in the
`nodeset` directory. For example, to run against CentOS 6.4:

BEAKER_set=centos-64-x64 bundle exec rake acceptance

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`.
16 changes: 16 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
source "https://rubygems.org"

group :test do
gem "rake"
gem "puppet", ENV['PUPPET_VERSION'] || '~> 3.8.1'
gem "rspec", '< 3.2.0'
gem "rspec-puppet"
gem "puppetlabs_spec_helper"
gem "metadata-json-lint"
gem "rspec-puppet-facts"
end

group :system_tests do
gem "beaker", '~> 2.11.0'
gem "beaker-rspec"
end
13 changes: 13 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Copyright 2015 Puppet Labs

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.
87 changes: 87 additions & 0 deletions README.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#puppet_agent

#### Table of Contents

1. [Overview](#overview)
2. [Module Description - What the module does and why it is useful](#module-description)
3. [Setup - The basics of getting started with puppet_agent](#setup)
* [What puppet_agent affects](#what-puppet_agent-affects)
* [Setup requirements](#setup-requirements)
* [Beginning with puppet_agent](#beginning-with-puppet_agent)
4. [Usage - Configuration options and additional functionality](#usage)
5. [Reference](#reference)
* [Public classes](#public-classes)
* [Private classes](#private-classes)
* [Parameters](#parameters)
6. [Limitations - OS compatibility, etc.](#limitations)
7. [Development - Guide for contributing to the module](#development)

## Overview

A module for upgrading Puppet 3.8 agents to puppet-agent in Puppet Collection 1 (i.e., Puppet 4).

## Module Description

The puppet_agent module installs the Puppet Collection 1 repo (on systems that support repositories); migrates configuration required by Puppet to new locations used by puppet-agent; and installs the puppet-agent package, removing the previous Puppet installation. This module expects Puppet to be installed from packages.

## Setup

### What puppet_agent affects

* Puppet, Facter, Hiera, and MCollective.
* Puppet's SSL directory and puppet.conf.
* MCollective's server.cfg.
* Removes deprecated settings from puppet.conf.
* Updates puppet.conf and server.cfg for behavioral changes in puppet-agent (future parser is the now the default, and MCollective has a new varlog location).

### Setup Requirements

You must be running Puppet 3.8 with `stringify_facts` set to 'false'. Agents should already be pointed at a master running Puppet Server 2.1 or greater, and thus successfully applying catalogs compiled with the Puppet 4 language.

### Beginning with puppet_agent

Install the puppet_agent module with `puppet module install puppetlabs-puppet_agent`.

## Usage

Add the class to agents you want to upgrade:

~~~puppet
include ::puppet_agent
~~~

##Reference

###Public classes
* [`puppet_agent`](#class-puppetagent)

###Private classes
* `puppet_agent::config` : Configures the services.
* `puppet_agent::install`: Installs packages.
* `puppet_agent::prepare`: Prepares the agent for upgrade.
* `puppet_agent::service`: Ensures the services are running.

###Parameters

####Class: puppet_agent

#####`package_name`

The package to upgrade to, i.e., `puppet-agent`. Currently, the default and only accepted value is `puppet-agent`.

#####`service_name`

An array of services to start, normally `puppet` and `mcollective`. If the array is empty, no services are started.

## Limitations

Supports only RPM-based distros: Redhat and Centos 5/6/7.

##Development

Puppet Labs modules on the Puppet Forge are open projects, and community contributions are essential for keeping them great. We can't access the huge number of platforms and myriad of hardware, software, and deployment configurations that Puppet is intended to serve.

We want to keep it as easy as possible to contribute changes so that our modules work in your environment. There are a few guidelines that we need contributors to follow so that we can have a chance of keeping on top of things.

To contribute to the puppet_agent module, see [Contributing.md](https://github.com/puppetlabs/puppetlabs-puppet_agent/blob/master/CONTRIBUTING.md). You can also read the complete module contribution guide [on the Puppet Labs wiki.](http://projects.puppetlabs.com/projects/module-site/wiki/Module_contributing)

1 change: 0 additions & 1 deletion README.md

This file was deleted.

62 changes: 62 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Enable future parser and disable stringify facts for specs
require 'puppet/version'
if Puppet.version.to_f < 4.0
ENV['FUTURE_PARSER'] = 'yes'
ENV['STRINGIFY_FACTS'] = 'no'
end

require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet/vendor/semantic/lib/semantic' unless Puppet.version.to_f < 3.6
require 'puppet-lint/tasks/puppet-lint'
require 'puppet-syntax/tasks/puppet-syntax'

# These gems aren't always present, for instance
# on Travis with --without development
begin
require 'puppet_blacksmith/rake_tasks'
rescue LoadError
end

Rake::Task[:lint].clear

PuppetLint.configuration.relative = true
PuppetLint.configuration.send("disable_80chars")
PuppetLint.configuration.log_format = "%{path}:%{linenumber}:%{check}:%{KIND}:%{message}"
PuppetLint.configuration.fail_on_warnings = true

# Forsake support for Puppet 2.6.2 for the benefit of cleaner code.
# http://puppet-lint.com/checks/class_parameter_defaults/
PuppetLint.configuration.send('disable_class_parameter_defaults')
# http://puppet-lint.com/checks/class_inherits_from_params_class/
PuppetLint.configuration.send('disable_class_inherits_from_params_class')

exclude_paths = [
"bundle/**/*",
"pkg/**/*",
"vendor/**/*",
"spec/**/*",
]
PuppetLint.configuration.ignore_paths = exclude_paths
PuppetSyntax.exclude_paths = exclude_paths

desc "Run acceptance tests"
RSpec::Core::RakeTask.new(:acceptance) do |t|
t.pattern = 'spec/acceptance'
end

desc "Populate CONTRIBUTORS file"
task :contributors do
system("git log --format='%aN' | sort -u > CONTRIBUTORS")
end

task :metadata do
sh "metadata-json-lint metadata.json"
end

desc "Run syntax, lint, and spec tests."
task :test => [
:syntax,
:lint,
:spec,
:metadata,
]
12 changes: 12 additions & 0 deletions examples/init.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# The baseline for module testing used by Puppet Labs is that each manifest
# should have a corresponding test manifest that declares that class or defined
# type.
#
# Tests are then run by using puppet apply --noop (to check for compilation
# errors and view a log of events) or by fully applying the test in a virtual
# environment (to compare the resulting system state to the desired state).
#
# Learn more about module testing here:
# http://docs.puppetlabs.com/guides/tests_smoke.html
#
include ::puppet_agent
Empty file added files/.gitkeep
Empty file.
30 changes: 30 additions & 0 deletions files/RPM-GPG-KEY-puppetlabs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)

mQINBEw3u0ABEAC1+aJQpU59fwZ4mxFjqNCgfZgDhONDSYQFMRnYC1dzBpJHzI6b
fUBQeaZ8rh6N4kZ+wq1eL86YDXkCt4sCvNTP0eF2XaOLbmxtV9bdpTIBep9bQiKg
5iZaz+brUZlFk/MyJ0Yz//VQ68N1uvXccmD6uxQsVO+gx7rnarg/BGuCNaVtGwy+
S98g8Begwxs9JmGa8pMCcSxtC7fAfAEZ02cYyrw5KfBvFI3cHDdBqrEJQKwKeLKY
GHK3+H1TM4ZMxPsLuR/XKCbvTyl+OCPxU2OxPjufAxLlr8BWUzgJv6ztPe9imqpH
Ppp3KuLFNorjPqWY5jSgKl94W/CO2x591e++a1PhwUn7iVUwVVe+mOEWnK5+Fd0v
VMQebYCXS+3dNf6gxSvhz8etpw20T9Ytg4EdhLvCJRV/pYlqhcq+E9le1jFOHOc0
Nc5FQweUtHGaNVyn8S1hvnvWJBMxpXq+Bezfk3X8PhPT/l9O2lLFOOO08jo0OYiI
wrjhMQQOOSZOb3vBRvBZNnnxPrcdjUUm/9cVB8VcgI5KFhG7hmMCwH70tpUWcZCN
NlI1wj/PJ7Tlxjy44f1o4CQ5FxuozkiITJvh9CTg+k3wEmiaGz65w9jRl9ny2gEl
f4CR5+ba+w2dpuDeMwiHJIs5JsGyJjmA5/0xytB7QvgMs2q25vWhygsmUQARAQAB
tEdQdXBwZXQgTGFicyBSZWxlYXNlIEtleSAoUHVwcGV0IExhYnMgUmVsZWFzZSBL
ZXkpIDxpbmZvQHB1cHBldGxhYnMuY29tPokCPgQTAQIAKAIbAwYLCQgHAwIGFQgC
CQoLBBYCAwECHgECF4AFAk/x5PoFCQtIMjoACgkQEFS3okvW7DAIKQ/9HvZyf+LH
VSkCk92Kb6gckniin3+5ooz67hSr8miGBfK4eocqQ0H7bdtWjAILzR/IBY0xj6OH
KhYP2k8TLc7QhQjt0dRpNkX+Iton2AZryV7vUADreYz44B0bPmhiE+LL46ET5ITh
LKu/KfihzkEEBa9/t178+dO9zCM2xsXaiDhMOxVE32gXvSZKP3hmvnK/FdylUY3n
WtPedr+lHpBLoHGaPH7cjI+MEEugU3oAJ0jpq3V8n4w0jIq2V77wfmbD9byIV7dX
cxApzciK+ekwpQNQMSaceuxLlTZKcdSqo0/qmS2A863YZQ0ZBe+Xyf5OI33+y+Mr
y+vl6Lre2VfPm3udgR10E4tWXJ9Q2CmG+zNPWt73U1FD7xBI7PPvOlyzCX4QJhy2
Fn/fvzaNjHp4/FSiCw0HvX01epcersyun3xxPkRIjwwRM9m5MJ0o4hhPfa97zibX
Sh8XXBnosBQxeg6nEnb26eorVQbqGx0ruu/W2m5/JpUfREsFmNOBUbi8xlKNS5CZ
ypH3Zh88EZiTFolOMEh+hT6s0l6znBAGGZ4m/Unacm5yDHmg7unCk4JyVopQ2KHM
oqG886elu+rm0ASkhyqBAk9sWKptMl3NHiYTRE/m9VAkugVIB2pi+8u84f+an4Hm
l4xlyijgYu05pqNvnLRyJDLd61hviLC8GYU=
=qHKb
-----END PGP PUBLIC KEY BLOCK-----
30 changes: 30 additions & 0 deletions lib/facter/mco_config.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
['server', 'client'].each do |node|
Facter.add("mco_#{node}_config") do
setcode do
config = nil
["/etc/puppetlabs/mcollective/#{node}.cfg", "/etc/mcollective/#{node}.cfg"].each do |cfg|
if File.exists? cfg
config = cfg
end
end
config
end
end

Facter.add("mco_#{node}_settings") do
setcode do
settings = nil
config = Facter.fact("mco_#{node}_config".to_sym)
if config and config.value
settings = Hash[File.readlines(config.value).select {|v|
v.lstrip =~ /[^#].+=.+/
}.map {|x|
x.split('=', 2).map {|s| s.strip}
}.select {|k, v|
k == 'libdir' || k == 'plugin.yaml'
}]
end
settings
end
end
end
Loading