Revision 2418bacd
Added by Eric Helms almost 10 years ago
.fixtures.yml | ||
---|---|---|
fixtures:
|
||
repositories:
|
||
stdlib: "git://github.com/puppetlabs/puppetlabs-stdlib.git"
|
||
foreman: "git://github.com/theforeman/puppet-foreman.git"
|
||
concat:
|
||
repo: "git://github.com/ripienaar/puppet-concat.git"
|
||
ref: "04356974f72b90a1d0f57346a00e95a717924e43"
|
||
concat_native: "git://github.com/theforeman/puppet-concat.git"
|
||
postgresql: "git://github.com/puppetlabs/puppetlabs-postgresql.git"
|
||
symlinks:
|
||
candlepin: "#{source_dir}"
|
.travis.yml | ||
---|---|---|
---
|
||
language: ruby
|
||
bundler_args: --without development
|
||
before_install: rm Gemfile.lock || true
|
||
rvm:
|
||
- 1.8.7
|
||
- 1.9.3
|
||
script:
|
||
- rake lint
|
||
- 2.0.0
|
||
- 2.1.0
|
||
script: bundle exec rake test
|
||
env:
|
||
- PUPPET_VERSION="~> 2.7.0"
|
||
- PUPPET_VERSION="~> 3.2.0"
|
||
- PUPPET_VERSION="~> 3.3.0"
|
||
- PUPPET_VERSION="~> 3.4.0"
|
||
- PUPPET_VERSION="~> 3.5.0"
|
||
- PUPPET_VERSION="~> 3.6.0"
|
||
matrix:
|
||
exclude:
|
||
- rvm: 1.9.3
|
||
env: PUPPET_VERSION="~> 2.7.0"
|
||
- rvm: 2.0.0
|
||
env: PUPPET_VERSION="~> 2.7.0"
|
||
- rvm: 2.1.0
|
||
env: PUPPET_VERSION="~> 2.7.0"
|
||
- rvm: 2.1.0
|
||
env: PUPPET_VERSION="~> 3.2.0"
|
||
- rvm: 2.1.0
|
||
env: PUPPET_VERSION="~> 3.3.0"
|
||
- rvm: 2.1.0
|
||
env: PUPPET_VERSION="~> 3.4.0"
|
CHANGELOG | ||
---|---|---|
2014-07-27 Release 0.1.0
|
CONTRIBUTING.md | ||
---|---|---|
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. Open an issue here - http://projects.theforeman.org/projects/katello/issues/new
|
||
|
||
6. Ensure commit message begins with 'Fixes #<redmine_issue_number>'
|
||
|
||
5. Push to your fork andaa 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
|
||
|
||
## 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 an Ubuntu 12.04 virtual machine. You can also
|
||
run the integration tests against Centos 6.5 with.
|
||
|
||
RS_SET=centos-64-x64 bundle exec rake acceptances
|
||
|
||
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_fies`.
|
||
|
CONTRIBUTORS | ||
---|---|---|
Ivan Necas @iNecas
|
||
Eric D Helms @ehelms
|
||
Alex Wood @awood
|
||
Jason Montleon @jmontleon
|
Gemfile | ||
---|---|---|
source 'https://rubygems.org'
|
||
source "https://rubygems.org"
|
||
|
||
if ENV.key?('PUPPET_VERSION')
|
||
puppetversion = "~> #{ENV['PUPPET_VERSION']}"
|
||
else
|
||
puppetversion = ['>= 2.6']
|
||
group :test do
|
||
gem "rake"
|
||
gem "puppet", ENV['PUPPET_VERSION'] || '~> 3.4.0'
|
||
gem "puppet-lint"
|
||
gem "rspec-puppet", :git => 'https://github.com/rodjek/rspec-puppet.git'
|
||
gem "puppet-syntax"
|
||
gem "puppetlabs_spec_helper"
|
||
end
|
||
|
||
gem 'puppet', puppetversion
|
||
gem 'puppet-lint', '>=0.3.2'
|
||
group :development do
|
||
gem "travis"
|
||
gem "travis-lint"
|
||
gem "beaker"
|
||
gem "beaker-rspec"
|
||
gem "vagrant-wrapper"
|
||
gem "puppet-blacksmith"
|
||
gem "guard-rake"
|
||
end
|
Modulefile | ||
---|---|---|
name 'katello-candlepin'
|
||
version '0.1.0'
|
||
source 'https://github.com/Katello/puppet-candlepin.git'
|
||
author 'Katello'
|
||
license 'GPLv3+'
|
||
summary 'Configure and install a Candlepin entitlement server.'
|
||
description 'Configure and install a Candlepin entitlement server.'
|
||
project_page 'https://github.com/Katello/puppet-candlepin'
|
||
|
||
dependency 'puppetlabs/stdlib', '>= 4.2.0'
|
||
dependency 'puppetlabs/postgresql', '>= 3.0.0'
|
||
dependency 'theforeman/foreman', '>= 1.5.0'
|
||
dependency 'theforeman/concat_native', '>= 1.3.0'
|
README.md | ||
---|---|---|
####Table of Contents
|
||
|
||
1. [Overview](#overview)
|
||
2. [Setup - The basics of getting started with candlepin](#setup)
|
||
* [What candlepin affects](#what-candlepin-affects)
|
||
* [Setup requirements](#setup-requirements)
|
||
* [Beginning with candlepin](#beginning-with-candlepin)
|
||
3. [Usage - Configuration options and additional functionality](#usage)
|
||
4. [Reference - An under-the-hood peek at what the module is doing and how](#reference)
|
||
5. [Limitations - OS compatibility, etc.](#limitations)
|
||
6. [Development - Guide for contributing to the module](#development)
|
||
|
||
##Overview
|
||
|
||
This module is designed to setup a Candlepin server.
|
||
|
||
##Setup
|
||
|
||
###What candlepin affects
|
||
|
||
* Installs and configures a Candlepin server
|
||
|
||
###Beginning with candlepin
|
||
|
||
The very basic steps needed for a user to get the module up and running.
|
||
|
||
If your most recent release breaks compatibility or requires particular steps for upgrading, you may wish to include an additional section here: Upgrading (For an example, see http://forge.puppetlabs.com/puppetlabs/firewall).
|
||
|
||
##Usage
|
||
|
||
##Reference
|
||
|
||
##Limitations
|
||
|
||
* EL6 (RHEL6 / CentOS 6)
|
||
|
||
##Development
|
||
|
||
See the CONTRIBUTING guide for steps on how to make a change and get it accepted upstream.
|
||
|
Rakefile | ||
---|---|---|
require 'puppetlabs_spec_helper/rake_tasks'
|
||
require 'puppet-lint/tasks/puppet-lint'
|
||
require 'puppet-syntax/tasks/puppet-syntax'
|
||
|
||
# These two gems aren't always present, for instance
|
||
# on Travis with --without development
|
||
begin
|
||
require 'puppet_blacksmith/rake_tasks'
|
||
rescue LoadError
|
||
end
|
||
|
||
PuppetLint.configuration.log_format = '%{path}:%{linenumber}:%{KIND}: %{message}'
|
||
PuppetLint.configuration.fail_on_warnings = true
|
||
PuppetLint.configuration.send("disable_class_inherits_from_params_class")
|
||
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')
|
||
# http://puppet-lint.com/checks/autoloader_layout/
|
||
PuppetLint.configuration.send('disable_autoloader_layout')
|
||
|
||
exclude_paths = [
|
||
"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
|
||
|
||
task :default => [:lint]
|
||
desc "Run syntax, lint, and spec tests."
|
||
task :test => [
|
||
:syntax,
|
||
:lint,
|
||
:spec,
|
||
]
|
manifests/config.pp | ||
---|---|---|
}
|
||
|
||
file { '/etc/candlepin':
|
||
ensure => directory,
|
||
mode => '0775',
|
||
owner => 'root',
|
||
group => 'tomcat',
|
||
ensure => directory,
|
||
mode => '0775',
|
||
owner => 'root',
|
||
group => 'tomcat',
|
||
}
|
||
|
||
file { '/etc/candlepin/candlepin.conf':
|
||
... | ... | |
}
|
||
|
||
file { "/etc/${candlepin::tomcat}":
|
||
ensure => directory,
|
||
mode => '0775',
|
||
owner => 'root',
|
||
group => 'tomcat',
|
||
ensure => directory,
|
||
mode => '0775',
|
||
owner => 'root',
|
||
group => 'tomcat',
|
||
}
|
||
|
||
file { "/etc/${candlepin::tomcat}/server.xml":
|
||
... | ... | |
}
|
||
|
||
file { '/var/log/candlepin':
|
||
ensure => directory,
|
||
mode => '0775',
|
||
owner => 'tomcat',
|
||
group => 'tomcat',
|
||
ensure => directory,
|
||
mode => '0775',
|
||
owner => 'tomcat',
|
||
group => 'tomcat',
|
||
}
|
||
|
||
file { "/var/log/${candlepin::tomcat}":
|
||
ensure => directory,
|
||
mode => '0775',
|
||
owner => 'root',
|
||
group => 'tomcat',
|
||
ensure => directory,
|
||
mode => '0775',
|
||
owner => 'root',
|
||
group => 'tomcat',
|
||
}
|
||
|
||
file { "/var/lib/${candlepin::tomcat}":
|
||
ensure => directory,
|
||
mode => '0775',
|
||
owner => 'tomcat',
|
||
group => 'tomcat',
|
||
ensure => directory,
|
||
mode => '0775',
|
||
owner => 'tomcat',
|
||
group => 'tomcat',
|
||
}
|
||
|
||
file { "/var/cache/${candlepin::tomcat}":
|
||
ensure => directory,
|
||
mode => '0775',
|
||
owner => 'tomcat',
|
||
group => 'tomcat',
|
||
ensure => directory,
|
||
mode => '0775',
|
||
owner => 'tomcat',
|
||
group => 'tomcat',
|
||
}
|
||
|
||
}
|
spec/classes/candlepin_spec.rb | ||
---|---|---|
require 'spec_helper'
|
||
|
||
describe 'candlepin' do
|
||
|
||
context 'on redhat' do
|
||
let :facts do
|
||
{
|
||
:concat_basedir => '/tmp',
|
||
:operatingsystem => 'RedHat',
|
||
:operatingsystemrelease => '6.4',
|
||
:operatingsystemmajrelease => '6.4',
|
||
:osfamily => 'RedHat',
|
||
}
|
||
end
|
||
|
||
it { should contain_class('candlepin::install') }
|
||
it { should contain_class('candlepin::config') }
|
||
it { should contain_class('candlepin::service') }
|
||
end
|
||
|
||
end
|
spec/classes/coverage_spec.rb | ||
---|---|---|
at_exit { RSpec::Puppet::Coverage.report! }
|
spec/spec_helper.rb | ||
---|---|---|
require 'puppetlabs_spec_helper/module_spec_helper'
|
spec/spec_helper_acceptance.rb | ||
---|---|---|
require 'beaker-rspec/spec_helper'
|
||
require 'beaker-rspec/helpers/serverspec'
|
||
|
||
hosts.each do |host|
|
||
# Install Puppet
|
||
install_puppet
|
||
end
|
||
|
||
RSpec.configure do |c|
|
||
# Project root
|
||
proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
||
|
||
# Readable test descriptions
|
||
c.formatter = :documentation
|
||
|
||
# Configure all nodes in nodeset
|
||
c.before :suite do
|
||
# Install module and dependencies
|
||
puppet_module_install(:source => proj_root, :module_name => 'katello_devel')
|
||
hosts.each do |host|
|
||
on host, puppet('module', 'install', 'puppetlabs-stdlib'), { :acceptable_exit_codes => [0,1] }
|
||
end
|
||
end
|
||
end
|
Also available in: Unified diff
Refs #6736: Update to standard layout and basic tests.