Revision fa8e07ff
Added by Eric Helms over 8 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"
|
||
stdlib: 'git://github.com/puppetlabs/puppetlabs-stdlib.git'
|
||
foreman: 'git://github.com/theforeman/puppet-foreman.git'
|
||
concat: 'git://github.com/puppetlabs/puppetlabs-concat'
|
||
postgresql: 'git://github.com/puppetlabs/puppetlabs-postgresql.git'
|
||
symlinks:
|
||
candlepin: "#{source_dir}"
|
manifests/config.pp | ||
---|---|---|
groups => $candlepin::user_groups,
|
||
}
|
||
|
||
concat{$::candlepin::candlepin_conf_file:
|
||
concat::fragment { 'General Config':
|
||
target => $::candlepin::candlepin_conf_file,
|
||
content => template('candlepin/candlepin.conf.erb'),
|
||
}
|
||
|
||
concat{ $::candlepin::candlepin_conf_file:
|
||
mode => '0600',
|
||
owner => 'tomcat',
|
||
group => 'tomcat',
|
||
}
|
||
|
||
concat::fragment {'General Config':
|
||
target => $::candlepin::candlepin_conf_file,
|
||
content => template('candlepin/candlepin.conf.erb'),
|
||
}
|
||
|
||
file { "/etc/${candlepin::tomcat}/server.xml":
|
||
ensure => file,
|
||
content => template("candlepin/${candlepin::tomcat}/server.xml.erb"),
|
manifests/database/mysql.pp | ||
---|---|---|
|
||
concat::fragment{'Mysql Database Configuration':
|
||
target => $::candlepin::candlepin_conf_file,
|
||
content => template('candlepin/candlepin_database.conf.erb'),
|
||
content => template('candlepin/_candlepin_database.conf.erb'),
|
||
}
|
||
|
||
}
|
manifests/database/postgresql.pp | ||
---|---|---|
|
||
concat::fragment{'PostgreSQL Database Configuration':
|
||
target => $::candlepin::candlepin_conf_file,
|
||
content => template('candlepin/candlepin_database.conf.erb'),
|
||
content => template('candlepin/_candlepin_database.conf.erb'),
|
||
}
|
||
|
||
if $candlepin::manage_db == true {
|
manifests/init.pp | ||
---|---|---|
#
|
||
# == Parameters:
|
||
#
|
||
# $oauth_key:: The oauth key for talking to the candlepin API;
|
||
# default 'candlepin'
|
||
# $oauth_key:: The oauth key for talking to the candlepin API;
|
||
# default 'candlepin'
|
||
#
|
||
# $oauth_secret:: The oauth secret for talking to the candlepin API;
|
||
# default 'candlepin'
|
||
# $oauth_secret:: The oauth secret for talking to the candlepin API;
|
||
# default 'candlepin'
|
||
#
|
||
# $manage_db:: Boolean indicating if a database should be installed and configured.
|
||
# Set false if database is hosted on dedicated server.
|
||
# default true
|
||
# $manage_db:: Boolean indicating if a database should be installed and configured.
|
||
# Set false if database is hosted on dedicated server.
|
||
# default true
|
||
#
|
||
# $db_type:: The type of database Candlepin will be connecting too.
|
||
# options ['postgresql','mysql']
|
||
# default postgresql
|
||
# $db_type:: The type of database Candlepin will be connecting too.
|
||
# options ['postgresql','mysql']
|
||
# default postgresql
|
||
#
|
||
# $db_host:: url of database server.
|
||
# default localhost
|
||
# $db_host:: url of database server.
|
||
# default localhost
|
||
#
|
||
# $db_port:: port the database listens on. Only needs to be provided if different
|
||
# from standard port of the :db_type.
|
||
# ex. mysql will default to 3306 and postgresql will default to 5432.
|
||
# $db_port:: port the database listens on. Only needs to be provided if different
|
||
# from standard port of the :db_type.
|
||
# ex. mysql will default to 3306 and postgresql will default to 5432.
|
||
#
|
||
# $db_name:: The name of the Candlepin database;
|
||
# default 'candlepin'
|
||
# $db_name:: The name of the Candlepin database;
|
||
# default 'candlepin'
|
||
#
|
||
# $db_user:: The Candlepin database username;
|
||
# default 'candlepin'
|
||
# $db_user:: The Candlepin database username;
|
||
# default 'candlepin'
|
||
#
|
||
# $db_password:: The Candlepin database password;
|
||
# default 'candlepin'
|
||
# $db_password:: The Candlepin database password;
|
||
# default 'candlepin'
|
||
#
|
||
# $tomcat:: The system tomcat to use, tomcat6 on RHEL6 and tomcat on most Fedoras
|
||
# $tomcat:: The system tomcat to use, tomcat6 on RHEL6 and tomcat on most Fedoras
|
||
#
|
||
# $crl_file:: The Certificate Revocation File for Candlepin
|
||
# $crl_file:: The Certificate Revocation File for Candlepin
|
||
#
|
||
# $user_groups:: The user groups for the Candlepin tomcat user
|
||
# $user_groups:: The user groups for the Candlepin tomcat user
|
||
#
|
||
# $log_dir:: Directory for Candlepin logs;
|
||
# default '/var/log/candlepin'
|
||
# $log_dir:: Directory for Candlepin logs;
|
||
# default '/var/log/candlepin'
|
||
#
|
||
# $deployment_url:: The root URL to deploy the Web and API URLs at
|
||
# $deployment_url:: The root URL to deploy the Web and API URLs at
|
||
#
|
||
# $weburl:: The Candlepin Web URL which is configurable via the deployment_url
|
||
# $weburl:: The Candlepin Web URL which is configurable via the deployment_url
|
||
#
|
||
# $apiurl:: The Candlepin API URL which is configurable via the deployment_url
|
||
# $apiurl:: The Candlepin API URL which is configurable via the deployment_url
|
||
#
|
||
# $env_filtering_enabled:: default 'true'
|
||
# $env_filtering_enabled:: If subscription filtering is done on a per environment basis
|
||
#
|
||
# $thumbslug_enabled:: If using Thumbslug; default 'false'
|
||
# $thumbslug_enabled:: If using Thumbslug; default 'false'
|
||
#
|
||
# $thumbslug_oauth_key:: The oauth key for talking to Thumbslug
|
||
# $thumbslug_oauth_key:: The oauth key for talking to Thumbslug
|
||
#
|
||
# $thumbslug_oauth_secret:: The oauth secret for talking to Thumbslug
|
||
# $thumbslug_oauth_secret:: The oauth secret for talking to Thumbslug
|
||
#
|
||
# $keystore_password:: Password for keystore being used with Tomcat
|
||
# $keystore_password:: Password for keystore being used with Tomcat
|
||
#
|
||
# $ca_key:: CA key file to use
|
||
# $ca_key:: CA key file to use
|
||
#
|
||
# $ca_cert:: CA certificate file to use
|
||
# $ca_cert:: CA certificate file to use
|
||
#
|
||
# $ca_key_password:: CA key password
|
||
# $ca_key_password:: CA key password
|
||
#
|
||
# $version:: Version of Candlepin to install
|
||
# default 'installed'
|
||
# $version:: Version of Candlepin to install
|
||
#
|
||
# $run_init:: Boolean indicating if the init api should be called on Candlepin
|
||
# default true
|
||
# $run_init:: Boolean indicating if the init api should be called on Candlepin
|
||
#
|
||
# $adapter_module:: Candlepin adapter implementations to inject into the java runtime
|
||
# default is for Katello
|
||
# $adapter_module:: Candlepin adapter implementations to inject into the java runtime
|
||
#
|
||
# $amq_enable:: Boolean indicating if amq should be enabled and configured
|
||
# default is true
|
||
# $amq_enable:: Boolean indicating if amq should be enabled and configured
|
||
#
|
||
# $enable_hbm2ddl_validate:: Boolean that if true will perform a schema check to ensure compliance
|
||
# with the models, otherwise false will disable this check. Disabling
|
||
# this feature may be required if modifications are required to the schema.
|
||
# default is true
|
||
# $amqp_keystore:: Location of the amqp keystore to use
|
||
#
|
||
# $amqp_keystore_password:: Password for the amqp keystore
|
||
#
|
||
# $amqp_truststore:: Location of the amqp truststore to use
|
||
#
|
||
# $amqp_truststore_password:: Password for the amqp trusture
|
||
#
|
||
# $consumer_system_name_pattern:: Regex that consistutes a valid consumer name
|
||
#
|
||
# $enable_hbm2ddl_validate:: Boolean that if true will perform a schema check to ensure compliance
|
||
# with the models, otherwise false will disable this check. Disabling
|
||
# this feature may be required if modifications are required to the schema.
|
||
# default is true
|
||
#
|
||
class candlepin (
|
||
|
||
... | ... | |
$thumbslug_oauth_key = $candlepin::params::thumbslug_oauth_key,
|
||
$thumbslug_oauth_secret = $candlepin::params::thumbslug_oauth_secret,
|
||
|
||
$keystore_password = undef,
|
||
$keystore_password = $candlepin::params::keystore_password,
|
||
$amqp_keystore = $candlepin::params::amqp_keystore,
|
||
$amqp_keystore_password = $candlepin::params::amqp_keystore_password,
|
||
$amqp_truststore = $candlepin::params::amqp_truststore,
|
||
$amqp_truststore_password = $candlepin::params::amqp_truststore_password,
|
||
|
||
$ca_key = $candlepin::params::ca_key,
|
||
$ca_cert = $candlepin::params::ca_crt,
|
||
$ca_cert = $candlepin::params::ca_cert,
|
||
$ca_key_password = $candlepin::params::ca_key_password,
|
||
$qpid_ssl_port = $candlepin::params::qpid_ssl_port,
|
||
|
||
... | ... | |
$adapter_module = $candlepin::params::adapter_module,
|
||
$amq_enable = $candlepin::params::amq_enable,
|
||
$enable_hbm2ddl_validate = $candlepin::params::enable_hbm2ddl_validate,
|
||
|
||
$enable_basic_auth = $candlepin::params::enable_basic_auth,
|
||
$enable_trusted_auth = $candlepin::params::enable_trusted_auth,
|
||
$consumer_system_name_pattern = $candlepin::params::consumer_system_name_pattern,
|
||
|
||
) inherits candlepin::params {
|
||
|
||
validate_bool($amq_enable)
|
||
|
||
if $amq_enable {
|
||
validate_absolute_path($amqp_keystore)
|
||
validate_absolute_path($amqp_truststore)
|
||
validate_string($amqp_keystore_password)
|
||
validate_string($amqp_truststore_password)
|
||
}
|
||
|
||
validate_absolute_path($ca_key)
|
||
validate_absolute_path($ca_cert)
|
||
|
||
$weburl = "https://${::fqdn}/${candlepin::deployment_url}/distributors?uuid="
|
||
$apiurl = "https://${::fqdn}/${candlepin::deployment_url}/api/distributors/"
|
||
$amqpurl = "tcp://${::fqdn}:${qpid_ssl_port}?ssl='true'&ssl_cert_alias='amqp-client'"
|
manifests/params.pp | ||
---|---|---|
/^7\./ => 'tomcat',
|
||
default => 'tomcat6'
|
||
}
|
||
}
|
||
},
|
||
default => 'tomcat'
|
||
}
|
||
|
||
$manage_db = true
|
||
... | ... | |
|
||
# this comes from keystore
|
||
$db_password = cache_data('candlepin_db_password', random_password(32))
|
||
$amqp_keystore_password = $::certs::candlepin::keystore_password
|
||
$amqp_truststore_password = $::certs::candlepin::keystore_password
|
||
$keystore_password = undef
|
||
|
||
$amq_enable = false
|
||
$amqp_keystore_password = undef
|
||
$amqp_truststore_password = undef
|
||
$amqp_keystore = '/etc/candlepin/certs/amqp/candlepin.jks'
|
||
$amqp_truststore = '/etc/candlepin/certs/amqp/candlepin.truststore'
|
||
|
||
# where to store output from cpsetup execution
|
||
$log_dir = '/var/log/candlepin'
|
||
... | ... | |
|
||
$version = 'installed'
|
||
$run_init = true
|
||
$adapter_module = 'org.candlepin.katello.KatelloModule'
|
||
$amq_enable = true
|
||
$adapter_module = undef
|
||
$enable_hbm2ddl_validate = true
|
||
|
||
$enable_basic_auth = true
|
||
$enable_trusted_auth = false
|
||
|
||
$consumer_system_name_pattern = undef
|
||
}
|
metadata.json | ||
---|---|---|
{
|
||
"name": "katello-candlepin",
|
||
"version": "0.1.1",
|
||
"version": "0.2.0",
|
||
"author": "Katello",
|
||
"summary": "Configure and install Candlepin entitlement server.",
|
||
"license": "GPL-3.0+",
|
||
... | ... | |
"name": "puppetlabs-postgresql",
|
||
"version_requirement": ">= 3.0.0 < 5.0.0"
|
||
},
|
||
{
|
||
"name": "theforeman-concat_native",
|
||
"version_requirement": ">= 1.3.0 < 2.0.0"
|
||
},
|
||
{
|
||
"name": "puppetlabs-concat",
|
||
"version_requirement": ">= 1.0.0 < 3.0.0"
|
spec/classes/candlepin_config_spec.rb | ||
---|---|---|
require 'spec_helper'
|
||
|
||
describe 'candlepin::config' do
|
||
|
||
let :facts do
|
||
{
|
||
:concat_basedir => '/tmp',
|
||
:operatingsystem => 'RedHat',
|
||
:operatingsystemrelease => '6.4',
|
||
:osfamily => 'RedHat',
|
||
:fqdn => 'localhost',
|
||
}
|
||
end
|
||
|
||
describe 'without parameters' do
|
||
let :pre_condition do
|
||
"class {'candlepin':}"
|
||
end
|
||
|
||
it "should setup the config" do
|
||
should contain_concat__fragment('General Config').
|
||
with_content(/^candlepin.environment_content_filtering=true$/).
|
||
with_content(/^candlepin.auth.basic.enable=true$/).
|
||
with_content(/^candlepin.auth.trusted.enable=false$/).
|
||
with_content(/^candlepin.auth.oauth.enable=true$/).
|
||
with_content(/^candlepin.auth.oauth.consumer.candlepin.secret=candlepin$/).
|
||
with_content(/^candlepin.ca_key=\/etc\/candlepin\/certs\/candlepin-ca.key$/).
|
||
with_content(/^candlepin.ca_cert=\/etc\/candlepin\/certs\/candlepin-ca.crt$/).
|
||
with_content(/^candlepin.crl.file=\/var\/lib\/candlepin\/candlepin-crl.crl$/).
|
||
with({})
|
||
end
|
||
end
|
||
|
||
describe 'with custom adapter module' do
|
||
cp_version = '0.9.26'
|
||
|
||
let :pre_condition do
|
||
"class {'candlepin':
|
||
adapter_module => 'my.custom.adapter_module',
|
||
version => cp_version,
|
||
}"
|
||
end
|
||
|
||
it 'should set a custom module' do
|
||
should contain_concat__fragment('General Config').
|
||
with_content(/module.config.adapter_module=my.custom.adapter_module/)
|
||
end
|
||
end
|
||
|
||
context 'with amqp enabled' do
|
||
describe 'and default configuration' do
|
||
let :pre_condition do
|
||
"class {'candlepin':
|
||
amq_enable => true,
|
||
amqp_truststore_password => 'password',
|
||
amqp_keystore_password => 'password',
|
||
}"
|
||
end
|
||
|
||
it "should setup the amqp config" do
|
||
should contain_concat__fragment('General Config').
|
||
with_content(/^candlepin.amqp.enable=true$/).
|
||
with_content(/^candlepin.amqp.connect=tcp:\/\/localhost:5671\?ssl='true'&ssl_cert_alias='amqp-client'$/).
|
||
with_content(/^candlepin.amqp.keystore_password=password$/).
|
||
with_content(/^candlepin.amqp.keystore=\/etc\/candlepin\/certs\/amqp\/candlepin.jks$/).
|
||
with_content(/^candlepin.amqp.truststore_password=password$/).
|
||
with_content(/^candlepin.amqp.truststore=\/etc\/candlepin\/certs\/amqp\/candlepin.truststore$/).
|
||
with({})
|
||
end
|
||
end
|
||
|
||
describe 'specifying truststore and keystore locations' do
|
||
let :pre_condition do
|
||
"class {'candlepin':
|
||
amq_enable => true,
|
||
amqp_truststore_password => 'password',
|
||
amqp_keystore_password => 'password',
|
||
amqp_keystore => '/etc/pki/my.jks',
|
||
amqp_truststore => '/etc/pki/my.truststore',
|
||
}"
|
||
end
|
||
|
||
it "should setup the amqp config" do
|
||
should contain_concat__fragment('General Config').
|
||
with_content(/^candlepin.amqp.enable=true$/).
|
||
with_content(/^candlepin.amqp.connect=tcp:\/\/localhost:5671\?ssl='true'&ssl_cert_alias='amqp-client'$/).
|
||
with_content(/^candlepin.amqp.keystore_password=password$/).
|
||
with_content(/^candlepin.amqp.keystore=\/etc\/pki\/my.jks$/).
|
||
with_content(/^candlepin.amqp.truststore_password=password$/).
|
||
with_content(/^candlepin.amqp.truststore=\/etc\/pki\/my.truststore$/).
|
||
with({})
|
||
end
|
||
end
|
||
end
|
||
|
||
end
|
spec/classes/candlepin_database_spec.rb | ||
---|---|---|
require 'spec_helper'
|
||
|
||
describe 'candlepin::database' do
|
||
|
||
let(:db_user) { 'testuser' }
|
||
let(:db_password) { 'testpassword' }
|
||
|
||
let :facts do
|
||
{
|
||
:concat_basedir => '/tmp',
|
||
:operatingsystem => 'RedHat',
|
||
:operatingsystemrelease => '6.4',
|
||
:osfamily => 'RedHat',
|
||
}
|
||
end
|
||
|
||
describe 'with mysql' do
|
||
describe 'default' do
|
||
let :pre_condition do
|
||
"class {'candlepin':
|
||
db_type => 'mysql',
|
||
db_user => #{db_user},
|
||
db_password => #{db_password},
|
||
}"
|
||
end
|
||
|
||
it {should contain_class('candlepin::database::mysql') }
|
||
it {should_not contain_class('candlepin::database::postgresql') }
|
||
|
||
it do
|
||
should contain_concat__fragment('Mysql Database Configuration').
|
||
with_content(/jpa.config.hibernate.dialect=org.hibernate.dialect.MySQLDialect/).
|
||
with_content(/jpa.config.hibernate.connection.driver_class=com.mysql.jdbc.Driver/).
|
||
with_content(/jpa.config.hibernate.connection.url=jdbc:mysql:\/\/localhost:3306\/candlepin/).
|
||
with_content(/jpa.config.hibernate.connection.username=#{db_user}/).
|
||
with_content(/jpa.config.hibernate.connection.password=#{db_password}/).
|
||
with_content(/jpa.config.hibernate.hbm2ddl.auto=validate/)
|
||
end
|
||
end
|
||
|
||
describe 'and enable_hbm2ddl_validate = false' do
|
||
let :pre_condition do
|
||
"class {'candlepin':
|
||
db_type => 'mysql',
|
||
enable_hbm2ddl_validate => false,
|
||
}"
|
||
end
|
||
|
||
it do
|
||
should contain_concat__fragment('Mysql Database Configuration').
|
||
without_content(/jpa.config.hibernate.hbm2ddl.auto=validate/)
|
||
end
|
||
end
|
||
end
|
||
|
||
describe 'with postgres' do
|
||
describe 'default' do
|
||
let :pre_condition do
|
||
"class {'candlepin':
|
||
db_user => #{db_user},
|
||
db_password => #{db_password},
|
||
}"
|
||
end
|
||
|
||
it {should contain_class('candlepin::database::postgresql') }
|
||
it {should_not contain_class('candlepin::database::mysql') }
|
||
|
||
it do
|
||
should contain_concat__fragment('PostgreSQL Database Configuration').
|
||
with_content(/jpa.config.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect/).
|
||
with_content(/jpa.config.hibernate.connection.driver_class=org.postgresql.Driver/).
|
||
with_content(/jpa.config.hibernate.connection.url=jdbc:postgresql:\/\/localhost:5432\/candlepin/).
|
||
with_content(/jpa.config.hibernate.connection.username=#{db_user}/).
|
||
with_content(/jpa.config.hibernate.connection.password=#{db_password}/).
|
||
with_content(/jpa.config.hibernate.hbm2ddl.auto=validate/)
|
||
end
|
||
|
||
describe 'and enable_hbm2ddl_validate = false' do
|
||
let :pre_condition do
|
||
"class {'candlepin':
|
||
enable_hbm2ddl_validate => false,
|
||
}"
|
||
end
|
||
|
||
it do
|
||
should contain_concat__fragment('PostgreSQL Database Configuration').
|
||
without_content(/jpa.config.hibernate.hbm2ddl.auto=validate/)
|
||
end
|
||
end
|
||
end
|
||
end
|
||
|
||
describe 'with fake database' do
|
||
let :pre_condition do
|
||
"class {'candlepin':
|
||
db_type => 'fakedatabase'
|
||
}"
|
||
end
|
||
|
||
it do
|
||
expect {
|
||
to raise_error("Invalid db_type selected: fakedatabase. Valid options are ['mysql','postgresql'].")
|
||
}
|
||
end
|
||
end
|
||
|
||
end
|
spec/classes/candlepin_install_spec.rb | ||
---|---|---|
require 'spec_helper'
|
||
|
||
describe 'candlepin::install' do
|
||
|
||
context 'on el6' do
|
||
let :facts do
|
||
{
|
||
:concat_basedir => '/tmp',
|
||
:operatingsystem => 'RedHat',
|
||
:operatingsystemrelease => '6.4',
|
||
:operatingsystemmajrelease => '6',
|
||
:osfamily => 'RedHat',
|
||
}
|
||
end
|
||
|
||
let :pre_condition do
|
||
"class {'candlepin':}"
|
||
end
|
||
|
||
it { should contain_package('candlepin').with('ensure' => 'installed') }
|
||
it { should contain_package('candlepin-tomcat6').with('ensure' => 'installed') }
|
||
end
|
||
|
||
context 'on el7' do
|
||
let :facts do
|
||
{
|
||
:concat_basedir => '/tmp',
|
||
:operatingsystem => 'RedHat',
|
||
:operatingsystemrelease => '7.0',
|
||
:operatingsystemmajrelease => '7',
|
||
:osfamily => 'RedHat',
|
||
}
|
||
end
|
||
|
||
let :pre_condition do
|
||
"class {'candlepin':}"
|
||
end
|
||
|
||
it { should contain_package('candlepin').with('ensure' => 'installed') }
|
||
it { should contain_package('candlepin-tomcat').with('ensure' => 'installed') }
|
||
end
|
||
end
|
spec/classes/candlepin_spec.rb | ||
---|---|---|
|
||
describe 'candlepin' do
|
||
|
||
db_user = 'testuser'
|
||
db_password = 'testpassword'
|
||
|
||
context 'on rhel6' do
|
||
let :facts do
|
||
{
|
||
... | ... | |
it { should contain_class('candlepin::config') }
|
||
it { should contain_class('candlepin::database') }
|
||
it { should contain_class('candlepin::service') }
|
||
|
||
it { should contain_file('/etc/candlepin/candlepin.conf') }
|
||
|
||
it { should contain_service('tomcat6').with_ensure('running') }
|
||
|
||
describe 'with default configuration' do
|
||
it do
|
||
should contain_concat__fragment('General Config').
|
||
with_content(/module.config.adapter_module=org.candlepin.katello.KatelloModule/).
|
||
with_content(/candlepin.amqp.enable=true/)
|
||
end
|
||
|
||
it do
|
||
should contain_package('candlepin').with(
|
||
'ensure' => 'installed'
|
||
)
|
||
should contain_package('candlepin-tomcat6').with(
|
||
'ensure' => 'installed'
|
||
)
|
||
end
|
||
end
|
||
|
||
describe 'with modified configuration' do
|
||
cp_version = '0.9.26'
|
||
let :params do
|
||
{
|
||
:adapter_module => 'my.custom.adapter_module',
|
||
:amq_enable => false,
|
||
:version => cp_version,
|
||
}
|
||
end
|
||
|
||
it do
|
||
should contain_concat__fragment('General Config').
|
||
with_content(/module.config.adapter_module=my.custom.adapter_module/).
|
||
without_content(/candlepin.amqp.enable=true/)
|
||
end
|
||
|
||
it do
|
||
should contain_package('candlepin').with(
|
||
'ensure' => cp_version
|
||
)
|
||
should contain_package('candlepin-tomcat6').with(
|
||
'ensure' => cp_version
|
||
)
|
||
end
|
||
end
|
||
|
||
describe 'with mysql' do
|
||
describe 'default' do
|
||
let :params do
|
||
{
|
||
:db_type => 'mysql',
|
||
:db_user => db_user,
|
||
:db_password => db_password,
|
||
}
|
||
end
|
||
|
||
it {should contain_class('candlepin::database::mysql') }
|
||
it {should_not contain_class('candlepin::database::postgresql') }
|
||
|
||
it do
|
||
should contain_concat__fragment('Mysql Database Configuration').
|
||
with_content(/jpa.config.hibernate.dialect=org.hibernate.dialect.MySQLDialect/).
|
||
with_content(/jpa.config.hibernate.connection.driver_class=com.mysql.jdbc.Driver/).
|
||
with_content(/jpa.config.hibernate.connection.url=jdbc:mysql:\/\/localhost:3306\/candlepin/).
|
||
with_content(/jpa.config.hibernate.connection.username=#{db_user}/).
|
||
with_content(/jpa.config.hibernate.connection.password=#{db_password}/).
|
||
with_content(/jpa.config.hibernate.hbm2ddl.auto=validate/)
|
||
end
|
||
end
|
||
|
||
describe 'and enable_hbm2ddl_validate = false' do
|
||
let :params do
|
||
{
|
||
:db_type => 'mysql',
|
||
:enable_hbm2ddl_validate => false,
|
||
}
|
||
end
|
||
|
||
it do
|
||
should contain_concat__fragment('Mysql Database Configuration').
|
||
without_content(/jpa.config.hibernate.hbm2ddl.auto=validate/)
|
||
end
|
||
end
|
||
end
|
||
|
||
describe 'with postgres' do
|
||
describe 'default' do
|
||
let :params do
|
||
{
|
||
#:db_type => 'postgresql', #should be the default
|
||
:db_user => db_user,
|
||
:db_password => db_password,
|
||
}
|
||
end
|
||
|
||
it {should contain_class('candlepin::database::postgresql') }
|
||
it {should_not contain_class('candlepin::database::mysql') }
|
||
|
||
it do
|
||
should contain_concat__fragment('PostgreSQL Database Configuration').
|
||
with_content(/jpa.config.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect/).
|
||
with_content(/jpa.config.hibernate.connection.driver_class=org.postgresql.Driver/).
|
||
with_content(/jpa.config.hibernate.connection.url=jdbc:postgresql:\/\/localhost:5432\/candlepin/).
|
||
with_content(/jpa.config.hibernate.connection.username=#{db_user}/).
|
||
with_content(/jpa.config.hibernate.connection.password=#{db_password}/).
|
||
with_content(/jpa.config.hibernate.hbm2ddl.auto=validate/)
|
||
end
|
||
|
||
describe 'and enable_hbm2ddl_validate = false' do
|
||
let :params do
|
||
{
|
||
:db_type => 'postgresql',
|
||
:enable_hbm2ddl_validate => false,
|
||
}
|
||
end
|
||
|
||
it do
|
||
should contain_concat__fragment('PostgreSQL Database Configuration').
|
||
without_content(/jpa.config.hibernate.hbm2ddl.auto=validate/)
|
||
end
|
||
end
|
||
end
|
||
end
|
||
|
||
describe 'with fake database' do
|
||
let(:params) { {:db_type => 'fakedatabase'} }
|
||
|
||
it do
|
||
expect {
|
||
to raise_error("Invalid db_type selected: fakedatabase. Valid options are ['mysql','postgresql'].")
|
||
}
|
||
end
|
||
end
|
||
|
||
end
|
||
|
||
... | ... | |
it { should contain_class('candlepin::config') }
|
||
it { should contain_class('candlepin::database') }
|
||
it { should contain_class('candlepin::service') }
|
||
|
||
it { should contain_file('/etc/candlepin/candlepin.conf') }
|
||
|
||
it { should contain_service('tomcat').with_ensure('running') }
|
||
|
||
it do
|
||
should contain_package('candlepin').with(
|
||
'ensure' => 'installed'
|
||
)
|
||
should contain_package('candlepin-tomcat').with(
|
||
'ensure' => 'installed'
|
||
)
|
||
end
|
||
end
|
||
|
||
end
|
templates/_candlepin_database.conf.erb | ||
---|---|---|
jpa.config.hibernate.dialect=<%= @db_dialect %>
|
||
jpa.config.hibernate.connection.driver_class=<%= @db_driver %>
|
||
jpa.config.hibernate.connection.url=jdbc:<%= @db_type %>://<%= @db_host %>:<%= @db_port %>/<%= @db_name %>
|
||
<% if @enable_hbm2ddl_validate -%>
|
||
jpa.config.hibernate.hbm2ddl.auto=validate
|
||
<% end -%>
|
||
jpa.config.hibernate.connection.username=<%= @db_user %>
|
||
jpa.config.hibernate.connection.password=<%= @db_password %>
|
||
|
||
org.quartz.jobStore.misfireThreshold=60000
|
||
org.quartz.jobStore.useProperties=false
|
||
org.quartz.jobStore.dataSource=myDS
|
||
org.quartz.jobStore.tablePrefix=QRTZ_
|
||
org.quartz.jobStore.class=org.quartz.impl.jdbcjobstore.JobStoreTX
|
||
org.quartz.jobStore.driverDelegateClass=<%= @db_quartz_dialect %>
|
||
|
||
org.quartz.dataSource.myDS.driver=<%= @db_driver %>
|
||
org.quartz.dataSource.myDS.URL=jdbc:<%= @db_type %>://<%= @db_host %>:<%= @db_port %>/<%= @db_name %>
|
||
org.quartz.dataSource.myDS.user=<%= @db_user %>
|
||
org.quartz.dataSource.myDS.password=<%= @db_password %>
|
||
org.quartz.dataSource.myDS.maxConnections=5
|
templates/candlepin.conf.erb | ||
---|---|---|
#
|
||
# WARNING: THIS CONFIGURATION WAS GENERATED BY KATELLO-CONFIGURE TOOL,
|
||
# CHANGES WILL LIKELY BE OVERWRITTEN.
|
||
#
|
||
### File managed with puppet ###
|
||
## Module: '<%= scope.to_hash['module_name'] %>'
|
||
|
||
candlepin.consumer_system_name_pattern = .+
|
||
candlepin.environment_content_filtering=<%= @env_filtering_enabled %>
|
||
candlepin.auth.basic.enable = false
|
||
candlepin.auth.trusted.enable = false
|
||
<% if @amq_enable -%>
|
||
<% unless [nil, :undefined, :undef].include?(scope.lookupvar("candlepin::consumer_system_name_pattern")) -%>
|
||
candlepin.consumer_system_name_pattern=<%= @consumer_system_name_pattern %>
|
||
<%- end -%>
|
||
candlepin.environment_content_filtering=<%= scope['candlepin::env_filtering_enabled'] %>
|
||
candlepin.auth.basic.enable=<%= scope['candlepin::enable_basic_auth'] %>
|
||
candlepin.auth.trusted.enable=<%= scope['candlepin::enable_trusted_auth'] %>
|
||
|
||
<% if scope['candlepin::amq_enable'] -%>
|
||
# enable events via AMQP
|
||
candlepin.amqp.enable=true
|
||
candlepin.amqp.connect=<%= @amqpurl %>
|
||
candlepin.amqp.keystore_password=<%= @amqp_keystore_password %>
|
||
candlepin.amqp.truststore_password=<%= @amqp_truststore_password %>
|
||
candlepin.amqp.connect=<%= scope['candlepin::amqpurl'] %>
|
||
candlepin.amqp.keystore=<%= scope['candlepin::amqp_keystore'] %>
|
||
candlepin.amqp.keystore_password=<%= scope['candlepin::amqp_keystore_password'] %>
|
||
candlepin.amqp.truststore_password=<%= scope['candlepin::amqp_truststore_password'] %>
|
||
candlepin.amqp.truststore=<%= scope['candlepin::amqp_truststore'] %>
|
||
<%- end -%>
|
||
|
||
<% if scope['candlepin::oauth_key'] != "" -%>
|
||
candlepin.auth.oauth.enable=true
|
||
candlepin.auth.oauth.consumer.<%= scope['candlepin::oauth_key'] %>.secret=<%= scope['candlepin::oauth_secret'] %>
|
||
<%- end -%>
|
||
|
||
<% if @oauth_key != "" -%>
|
||
module.config.adapter_module=<%= @adapter_module %>
|
||
candlepin.auth.oauth.enable = true
|
||
candlepin.auth.oauth.consumer.<%= @oauth_key %>.secret = <%= @oauth_secret %>
|
||
candlepin.crl.file = <%= @crl_file %>
|
||
<% unless [nil, :undefined, :undef].include?(scope.lookupvar("candlepin::adapter_module")) -%>
|
||
module.config.adapter_module=<%= scope['candlepin::adapter_module'] %>
|
||
<%- end -%>
|
||
|
||
<% if @ca_key_password -%>
|
||
candlepin.ca_key_password = <%= @ca_key_password %>
|
||
candlepin.ca_key=<%= scope['candlepin::ca_key'] %>
|
||
candlepin.ca_cert=<%= scope['candlepin::ca_cert'] %>
|
||
candlepin.crl.file=<%= scope['candlepin::crl_file'] %>
|
||
<% unless [nil, :undefined, :undef].include?(scope.lookupvar("candlepin::ca_key_password")) -%>
|
||
candlepin.ca_key_password=<%= scope['candlepin::ca_key_password'] %>
|
||
<%- end -%>
|
||
candlepin.ca_key = <%= @ca_key %>
|
||
candlepin.ca_cert = <%= @ca_cert %>
|
templates/candlepin_database.conf.erb | ||
---|---|---|
jpa.config.hibernate.dialect=<%= @db_dialect %>
|
||
jpa.config.hibernate.connection.driver_class=<%= @db_driver %>
|
||
jpa.config.hibernate.connection.url=jdbc:<%= @db_type %>://<%= @db_host %>:<%= @db_port %>/<%= @db_name %>
|
||
<% if @enable_hbm2ddl_validate -%>
|
||
jpa.config.hibernate.hbm2ddl.auto=validate
|
||
<% end -%>
|
||
jpa.config.hibernate.connection.username=<%= @db_user %>
|
||
jpa.config.hibernate.connection.password=<%= @db_password %>
|
||
|
||
org.quartz.jobStore.misfireThreshold=60000
|
||
org.quartz.jobStore.useProperties=false
|
||
org.quartz.jobStore.dataSource=myDS
|
||
org.quartz.jobStore.tablePrefix=QRTZ_
|
||
org.quartz.jobStore.class=org.quartz.impl.jdbcjobstore.JobStoreTX
|
||
org.quartz.jobStore.driverDelegateClass=<%= @db_quartz_dialect %>
|
||
|
||
org.quartz.dataSource.myDS.driver=<%= @db_driver %>
|
||
org.quartz.dataSource.myDS.URL=jdbc:<%= @db_type %>://<%= @db_host %>:<%= @db_port %>/<%= @db_name %>
|
||
org.quartz.dataSource.myDS.user=<%= @db_user %>
|
||
org.quartz.dataSource.myDS.password=<%= @db_password %>
|
||
org.quartz.dataSource.myDS.maxConnections=5
|
templates/tomcat/server.xml.erb | ||
---|---|---|
<?xml version='1.0' encoding='utf-8'?>
|
||
<!--
|
||
#
|
||
# WARNING: THIS CONFIGURATION WAS GENERATED BY KATELLO-CONFIGURE TOOL,
|
||
# CHANGES WILL LIKELY BE OVERWRITTEN.
|
||
#
|
||
File managed with puppet ###
|
||
Module: '<%= scope.to_hash['module_name'] %>'
|
||
-->
|
||
<!--
|
||
Licensed to the Apache Software Foundation (ASF) under one or more
|
templates/tomcat6/server.xml.erb | ||
---|---|---|
<?xml version='1.0' encoding='utf-8'?>
|
||
<!--
|
||
#
|
||
# WARNING: THIS CONFIGURATION WAS GENERATED BY KATELLO-CONFIGURE TOOL,
|
||
# CHANGES WILL LIKELY BE OVERWRITTEN.
|
||
#
|
||
File managed with puppet ###
|
||
Module: '<%= scope.to_hash['module_name'] %>'
|
||
-->
|
||
<!--
|
||
Licensed to the Apache Software Foundation (ASF) under one or more
|
Also available in: Unified diff
Re-factor to Candlepin default configuration
This also removes direct references to the puppet-certs module and
allows more customization of Candlepin configuration. Note as well,
this changes the values of some configuration to match Candlepin
defaults and those values will need to be set explicitly by other
modules.