From a224667861f3d4bc22bb40c0fbaee1248161a568 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Fri, 26 Oct 2018 19:07:00 +0200 Subject: [PATCH 1/2] Refactor tests to not test private classes --- spec/classes/candlepin_config_spec.rb | 139 --------- spec/classes/candlepin_database_mysql_spec.rb | 57 ---- .../candlepin_database_postgresql_spec.rb | 60 ---- spec/classes/candlepin_install_spec.rb | 15 - spec/classes/candlepin_qpid_spec.rb | 32 --- spec/classes/candlepin_repo_spec.rb | 37 --- spec/classes/candlepin_service_spec.rb | 31 -- spec/classes/candlepin_spec.rb | 268 +++++++++++++++++- spec/classes/coverage_spec.rb | 3 - 9 files changed, 258 insertions(+), 384 deletions(-) delete mode 100644 spec/classes/candlepin_config_spec.rb delete mode 100644 spec/classes/candlepin_database_mysql_spec.rb delete mode 100644 spec/classes/candlepin_database_postgresql_spec.rb delete mode 100644 spec/classes/candlepin_install_spec.rb delete mode 100644 spec/classes/candlepin_qpid_spec.rb delete mode 100644 spec/classes/candlepin_repo_spec.rb delete mode 100644 spec/classes/candlepin_service_spec.rb delete mode 100644 spec/classes/coverage_spec.rb diff --git a/spec/classes/candlepin_config_spec.rb b/spec/classes/candlepin_config_spec.rb deleted file mode 100644 index cdcfc3c..0000000 --- a/spec/classes/candlepin_config_spec.rb +++ /dev/null @@ -1,139 +0,0 @@ -require 'spec_helper' - -describe 'candlepin::config' do - on_supported_os.each do |os, facts| - context "on #{os}" do - let(:facts) { facts } - - 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 'tomcat.conf' do - let :pre_condition do - "class {'candlepin':}" - end - it { should contain_file('/etc/tomcat/tomcat.conf') } - - it 'should contain settings' do - verify_exact_contents(catalogue, '/etc/tomcat/tomcat.conf', [ - 'TOMCAT_CFG_LOADED="1"', - 'TOMCATS_BASE="/var/lib/tomcats/"', - 'JAVA_HOME="/usr/lib/jvm/jre"', - 'CATALINA_HOME="/usr/share/tomcat"', - 'CATALINA_TMPDIR="/var/cache/tomcat/temp"', - 'JAVA_OPTS="-Xms1024m -Xmx4096m"', - 'SECURITY_MANAGER="0"', - ]) - end - end - - describe 'with custom adapter module' do - let :pre_condition do - "class {'candlepin': - adapter_module => 'my.custom.adapter_module', - }" - 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', - qpid_ssl_cert => '/path/to/ssl/cert', - qpid_ssl_key => '/path/to/ssl/key', - }" - 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', - qpid_ssl_cert => '/path/to/ssl/cert', - qpid_ssl_key => '/path/to/ssl/key', - }" - 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 - - describe 'with ssl_port' do - let :pre_condition do - "class {'candlepin': - ssl_port => 9070, - }" - end - - it "should setup the tomcat config file" do - should contain_file("/etc/tomcat/server.xml"). - with_content(/^ ['1.2', '1.3'], - }" - end - - it "should setup the tomcat config file" do - should contain_file("/etc/tomcat/server.xml"). - with_content(/sslProtocols="TLSv1.2,TLSv1.3"/). - with_content(/sslEnabledProtocols="TLSv1.2,TLSv1.3"/). - with({}) - end - end - end - end -end diff --git a/spec/classes/candlepin_database_mysql_spec.rb b/spec/classes/candlepin_database_mysql_spec.rb deleted file mode 100644 index a075522..0000000 --- a/spec/classes/candlepin_database_mysql_spec.rb +++ /dev/null @@ -1,57 +0,0 @@ -require 'spec_helper' - -describe 'candlepin::database::mysql' do - on_os_under_test.each do |os, facts| - context "on #{os}" do - let(:facts) { facts } - - describe 'default' do - let :pre_condition do - "class {'candlepin': - db_type => 'mysql', - db_password => 'testpassword', - }" - end - - it { should contain_class('candlepin::database::mysql') } - it { should_not contain_class('candlepin::database::postgresql') } - - it do - verify_concat_fragment_exact_contents(catalogue, 'Mysql Database Configuration', [ - 'jpa.config.hibernate.dialect=org.hibernate.dialect.MySQLDialect', - 'jpa.config.hibernate.connection.driver_class=com.mysql.jdbc.Driver', - 'jpa.config.hibernate.connection.url=jdbc:mysql://localhost:3306/candlepin', - 'jpa.config.hibernate.hbm2ddl.auto=validate', - 'jpa.config.hibernate.connection.username=candlepin', - 'jpa.config.hibernate.connection.password=testpassword', - '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=org.quartz.impl.jdbcjobstore.StdJDBCDelegate', - 'org.quartz.dataSource.myDS.driver=com.mysql.jdbc.Driver', - 'org.quartz.dataSource.myDS.URL=jdbc:mysql://localhost:3306/candlepin', - 'org.quartz.dataSource.myDS.user=candlepin', - 'org.quartz.dataSource.myDS.password=testpassword', - 'org.quartz.dataSource.myDS.maxConnections=5', - ]) - 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 - end -end diff --git a/spec/classes/candlepin_database_postgresql_spec.rb b/spec/classes/candlepin_database_postgresql_spec.rb deleted file mode 100644 index 610c604..0000000 --- a/spec/classes/candlepin_database_postgresql_spec.rb +++ /dev/null @@ -1,60 +0,0 @@ -require 'spec_helper' - -describe 'candlepin::database::postgresql' do - on_os_under_test.each do |os, facts| - context "on #{os}" do - let(:facts) { facts } - - describe 'default' do - let :pre_condition do - "class {'candlepin': - db_password => 'testpassword', - }" - end - - it { should contain_class('candlepin::database::postgresql') } - it { should_not contain_class('candlepin::database::mysql') } - it { should contain_exec('cpdb').that_subscribes_to('Package[candlepin]') } - it { should contain_exec('cpdb').that_comes_before('Service[tomcat]') } - it { should contain_exec('cpdb').that_comes_before('Exec[cpinit]') } - it { should contain_postgresql__server__db('candlepin') } - it { should contain_postgresql__server__role('candlepin').that_comes_before('Postgresql::Server::Database[candlepin]') } - - it do - verify_concat_fragment_exact_contents(catalogue, 'PostgreSQL Database Configuration', [ - 'jpa.config.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect', - 'jpa.config.hibernate.connection.driver_class=org.postgresql.Driver', - 'jpa.config.hibernate.connection.url=jdbc:postgresql://localhost:5432/candlepin', - 'jpa.config.hibernate.hbm2ddl.auto=validate', - 'jpa.config.hibernate.connection.username=candlepin', - 'jpa.config.hibernate.connection.password=testpassword', - '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=org.quartz.impl.jdbcjobstore.PostgreSQLDelegate', - 'org.quartz.dataSource.myDS.driver=org.postgresql.Driver', - 'org.quartz.dataSource.myDS.URL=jdbc:postgresql://localhost:5432/candlepin', - 'org.quartz.dataSource.myDS.user=candlepin', - 'org.quartz.dataSource.myDS.password=testpassword', - 'org.quartz.dataSource.myDS.maxConnections=5', - ]) - 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 - end -end diff --git a/spec/classes/candlepin_install_spec.rb b/spec/classes/candlepin_install_spec.rb deleted file mode 100644 index 0969a79..0000000 --- a/spec/classes/candlepin_install_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ -require 'spec_helper' - -describe 'candlepin::install' do - on_supported_os.each do |os, facts| - context "on #{os}" do - let(:facts) { facts } - - let :pre_condition do - "class {'candlepin':}" - end - - it { should contain_package('candlepin').with('ensure' => 'present') } - end - end -end diff --git a/spec/classes/candlepin_qpid_spec.rb b/spec/classes/candlepin_qpid_spec.rb deleted file mode 100644 index fb6630c..0000000 --- a/spec/classes/candlepin_qpid_spec.rb +++ /dev/null @@ -1,32 +0,0 @@ -require 'spec_helper' - -describe 'candlepin::config' do - on_supported_os.each do |os, facts| - context "on #{os}" do - let(:facts) { facts } - - describe 'without parameters' do - let :pre_condition do - "class {'candlepin': - qpid_ssl_cert => '/path/to/ssl/cert', - qpid_ssl_key => '/path/to/ssl/key', - amq_enable => true, - amqp_truststore_password => 'password', - amqp_keystore_password => 'password', - }" - end - - describe "should setup qpid event exchange" do - it { - is_expected.to contain_qpid__config__exchange('event') - .with('exchange' => 'event') - .with('hostname' => 'localhost') - .with('port' => 5671) - .with('ssl_cert' => '/path/to/ssl/cert') - .with('ssl_key' => '/path/to/ssl/key') - } - end - end - end - end -end diff --git a/spec/classes/candlepin_repo_spec.rb b/spec/classes/candlepin_repo_spec.rb deleted file mode 100644 index 1b0195e..0000000 --- a/spec/classes/candlepin_repo_spec.rb +++ /dev/null @@ -1,37 +0,0 @@ -require 'spec_helper' - -describe 'candlepin::repo' do - context 'with manage_repo => false' do let :params do - { - 'manage_repo' => false, - 'repo_version' => 'latest', - 'dist' => 'el7', - 'gpgcheck' => false, - 'gpgkey' => '', - } - end - - it { is_expected.not_to contain_yumrepo('candlepin') } - end - - context 'with manage_repo => true' do - let :params do - { - 'manage_repo' => true, - 'repo_version' => 'latest', - 'dist' => 'el7', - 'gpgcheck' => false, - 'gpgkey' => '', - } - end - - it do - is_expected.to contain_yumrepo('candlepin') - .with_descr('Candlepin: an open source entitlement management system.') - .with_baseurl("https://fedorapeople.org/groups/katello/releases/yum/latest/candlepin/el7/\$basearch/") - .with_gpgkey('') - .with_gpgcheck(false) - .with_enabled(true) - end - end -end diff --git a/spec/classes/candlepin_service_spec.rb b/spec/classes/candlepin_service_spec.rb deleted file mode 100644 index 520c492..0000000 --- a/spec/classes/candlepin_service_spec.rb +++ /dev/null @@ -1,31 +0,0 @@ -require 'spec_helper' - -describe 'candlepin::service' do - context 'with run_init => true' do - let :pre_condition do - 'package {"wget": }' - end - - let :params do - { - 'run_init' => true, - } - end - - it { is_expected.to compile.with_all_deps } - it { is_expected.to contain_service('tomcat') } - it { is_expected.to contain_exec('cpinit') } - end - - context 'with run_init false' do - let :params do - { - 'run_init' => false, - } - end - - it { is_expected.to compile.with_all_deps } - it { is_expected.to contain_service('tomcat') } - it { is_expected.not_to contain_exec('cpinit') } - end -end diff --git a/spec/classes/candlepin_spec.rb b/spec/classes/candlepin_spec.rb index b38437c..dde3d77 100644 --- a/spec/classes/candlepin_spec.rb +++ b/spec/classes/candlepin_spec.rb @@ -5,14 +5,261 @@ context "on #{os}" do let(:facts) { facts } - describe 'base class' do - it { should compile.with_all_deps } - it { should contain_class('candlepin::repo') } - it { should contain_class('candlepin::install') } - it { should contain_class('candlepin::config') } - it { should contain_class('candlepin::database::postgresql') } - it { should contain_class('candlepin::service') } - it { should contain_service('tomcat').with_ensure('running') } + describe 'default parameters' do + let :params do + {db_password: 'testpassword'} + end + + it { is_expected.to compile.with_all_deps } + + # repo + it { is_expected.to contain_class('candlepin::repo').with_manage_repo(false) } + it { is_expected.not_to contain_yumrepo('candlepin') } + + # install + it { is_expected.to contain_class('candlepin::install') } + it { is_expected.to contain_package('candlepin').with_ensure('present') } + it { is_expected.to contain_package('wget').with_ensure('present') } + + # config + it { is_expected.to contain_class('candlepin::config') } + it do + verify_concat_fragment_exact_contents(catalogue, 'General Config', [ + 'candlepin.environment_content_filtering=true', + 'candlepin.auth.basic.enable=true', + 'candlepin.auth.trusted.enable=false', + 'candlepin.auth.oauth.enable=true', + 'candlepin.auth.oauth.consumer.candlepin.secret=candlepin', + 'candlepin.ca_key=/etc/candlepin/certs/candlepin-ca.key', + 'candlepin.ca_cert=/etc/candlepin/certs/candlepin-ca.crt', + 'candlepin.crl.file=/var/lib/candlepin/candlepin-crl.crl', + 'log4j.logger.org.hibernate.internal.SessionImpl=ERROR', + ]) + end + it { is_expected.to contain_file('/etc/tomcat/tomcat.conf') } + + it do + verify_exact_contents(catalogue, '/etc/tomcat/tomcat.conf', [ + 'TOMCAT_CFG_LOADED="1"', + 'TOMCATS_BASE="/var/lib/tomcats/"', + 'JAVA_HOME="/usr/lib/jvm/jre"', + 'CATALINA_HOME="/usr/share/tomcat"', + 'CATALINA_TMPDIR="/var/cache/tomcat/temp"', + 'JAVA_OPTS="-Xms1024m -Xmx4096m"', + 'SECURITY_MANAGER="0"', + ]) + end + + # database + it { is_expected.not_to contain_class('candlepin::database::mysql') } + it { is_expected.to contain_class('candlepin::database::postgresql') } + it { is_expected.to contain_exec('cpdb').that_subscribes_to('Package[candlepin]').that_comes_before(['Exec[cpinit]', 'Service[tomcat]']) } + it { is_expected.to contain_postgresql__server__db('candlepin') } + it { is_expected.to contain_postgresql__server__role('candlepin').that_comes_before('Postgresql::Server::Database[candlepin]') } + + it do + verify_concat_fragment_exact_contents(catalogue, 'PostgreSQL Database Configuration', [ + 'jpa.config.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect', + 'jpa.config.hibernate.connection.driver_class=org.postgresql.Driver', + 'jpa.config.hibernate.connection.url=jdbc:postgresql://localhost:5432/candlepin', + 'jpa.config.hibernate.hbm2ddl.auto=validate', + 'jpa.config.hibernate.connection.username=candlepin', + 'jpa.config.hibernate.connection.password=testpassword', + '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=org.quartz.impl.jdbcjobstore.PostgreSQLDelegate', + 'org.quartz.dataSource.myDS.driver=org.postgresql.Driver', + 'org.quartz.dataSource.myDS.URL=jdbc:postgresql://localhost:5432/candlepin', + 'org.quartz.dataSource.myDS.user=candlepin', + 'org.quartz.dataSource.myDS.password=testpassword', + 'org.quartz.dataSource.myDS.maxConnections=5', + ]) + end + + # service + it { is_expected.to contain_class('candlepin::service') } + it { is_expected.to contain_service('tomcat') } + it { is_expected.to contain_exec('cpinit') } + it { is_expected.to contain_service('tomcat').with_ensure('running') } + end + + context 'with manage_repo => true' do + let(:params) do + {manage_repo: true} + end + + it { is_expected.to compile.with_all_deps } + + it do + is_expected.to contain_yumrepo('candlepin') + .with_descr('Candlepin: an open source entitlement management system.') + .with_baseurl("https://fedorapeople.org/groups/katello/releases/yum/latest/candlepin/el7/\$basearch/") + .with_gpgkey(nil) + .with_gpgcheck(false) + .with_enabled(true) + end + end + + describe 'with custom adapter module' do + let :params do + {adapter_module: 'my.custom.adapter_module'} + end + + it { is_expected.to compile.with_all_deps } + + it do + is_expected.to contain_concat__fragment('General Config'). + with_content(/^module.config.adapter_module=my.custom.adapter_module$/) + end + end + + context 'with amqp enabled' do + let :params do + { + amq_enable: true, + amqp_truststore_password: 'password', + amqp_keystore_password: 'password', + qpid_ssl_cert: '/path/to/ssl/cert', + qpid_ssl_key: '/path/to/ssl/key', + } + end + + describe 'with default parameters' do + it { is_expected.to compile.with_all_deps } + it do + is_expected.to 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$/) + end + + it do + is_expected.to contain_qpid__config__exchange('event') + .with_exchange('event') + .with_hostname('localhost') + .with_port(5671) + .with_ssl_cert('/path/to/ssl/cert') + .with_ssl_key('/path/to/ssl/key') + end + end + + describe 'specifying truststore and keystore locations' do + let :params do + super().merge( + amqp_keystore: '/etc/pki/my.jks', + amqp_truststore: '/etc/pki/my.truststore', + ) + end + + it { is_expected.to compile.with_all_deps } + it do + is_expected.to 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$/) + end + end + end + + describe 'with ssl_port' do + let :params do + {ssl_port: 9070} + end + + it { is_expected.to compile.with_all_deps } + it do + is_expected.to contain_file("/etc/tomcat/server.xml"). + with_content(/^ Date: Fri, 26 Oct 2018 19:07:21 +0200 Subject: [PATCH 2/2] Mark private classes as such --- manifests/config.pp | 1 + manifests/database/mysql.pp | 2 ++ manifests/database/postgresql.pp | 2 ++ manifests/install.pp | 2 ++ manifests/qpid.pp | 1 + manifests/service.pp | 7 +++---- 6 files changed, 11 insertions(+), 4 deletions(-) diff --git a/manifests/config.pp b/manifests/config.pp index 1508816..8b6fde2 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -1,5 +1,6 @@ # Configuration for Candlepin class candlepin::config { + assert_private() user { 'tomcat': ensure => present, diff --git a/manifests/database/mysql.pp b/manifests/database/mysql.pp index 41a8f5f..7906745 100644 --- a/manifests/database/mysql.pp +++ b/manifests/database/mysql.pp @@ -12,6 +12,8 @@ $db_password = $::candlepin::db_password, $enable_hbm2ddl_validate = $::candlepin::enable_hbm2ddl_validate, ) { + assert_private() + concat::fragment{'Mysql Database Configuration': target => $candlepin_conf_file, content => template('candlepin/_candlepin_database.conf.erb'), diff --git a/manifests/database/postgresql.pp b/manifests/database/postgresql.pp index 2551dba..e0656e2 100644 --- a/manifests/database/postgresql.pp +++ b/manifests/database/postgresql.pp @@ -19,6 +19,8 @@ $log_dir = $::candlepin::log_dir, ) { + assert_private() + concat::fragment{'PostgreSQL Database Configuration': target => $candlepin_conf_file, content => template('candlepin/_candlepin_database.conf.erb'), diff --git a/manifests/install.pp b/manifests/install.pp index 0a1af7e..014ac8d 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -1,5 +1,7 @@ # Candlepin installation packages class candlepin::install { + assert_private() + package { ['candlepin']: ensure => $candlepin::version, } diff --git a/manifests/qpid.pp b/manifests/qpid.pp index b19f8a3..ae2f8f6 100644 --- a/manifests/qpid.pp +++ b/manifests/qpid.pp @@ -1,5 +1,6 @@ # Qpid setup for Candlepin class candlepin::qpid { + assert_private() if $::candlepin::amq_enable { qpid::config::exchange { 'event': diff --git a/manifests/service.pp b/manifests/service.pp index eca3c4d..668cb85 100644 --- a/manifests/service.pp +++ b/manifests/service.pp @@ -1,7 +1,6 @@ # Candlepin Service and Initialization -class candlepin::service( - Boolean $run_init = $::candlepin::run_init, -) { +class candlepin::service { + assert_private() service { 'tomcat': ensure => running, @@ -10,7 +9,7 @@ hasrestart => true, } - if $run_init { + if $::candlepin::run_init { exec { 'cpinit': # tomcat startup is slow - try multiple times (the initialization service is idempotent) command => '/usr/bin/wget --no-proxy --timeout=30 --tries=40 --wait=20 --retry-connrefused -qO- http://localhost:8080/candlepin/admin/init > /var/log/candlepin/cpinit.log 2>&1 && touch /var/lib/candlepin/cpinit_done',