From 60db8d4eb694ad02ed4d99977b0a5e8446a7f48c Mon Sep 17 00:00:00 2001 From: Ian Ballou Date: Thu, 9 Apr 2020 14:06:01 +0000 Subject: [PATCH] Add postgresql-evr extension to katello --- manifests/application.pp | 8 ++++++++ manifests/candlepin.pp | 5 +---- manifests/params.pp | 11 ++++++++++- spec/classes/application_spec.rb | 1 + 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/manifests/application.pp b/manifests/application.pp index 79378d39..1be581f0 100644 --- a/manifests/application.pp +++ b/manifests/application.pp @@ -63,6 +63,8 @@ $candlepin_event_queue = $katello::params::candlepin_event_queue $crane_url = $katello::params::crane_url $crane_ca_cert = $certs::katello_server_ca_cert + $scl_postgresql = $katello::params::scl_postgresql + $postgresql_evr_package = $katello::params::postgresql_evr_package # Katello database seeding needs candlepin Anchor <| title == 'katello::repo' or title == 'katello::candlepin' |> -> @@ -72,6 +74,12 @@ config_file => "${foreman::plugin_config_dir}/katello.yaml", } + if $katello::candlepin::manage_db { + package { "${$scl_postgresql}-${postgresql_evr_package}": + ensure => installed, + } + } + foreman::config::apache::fragment { 'katello': ssl_content => file('katello/katello-apache-ssl.conf'), } diff --git a/manifests/candlepin.pp b/manifests/candlepin.pp index a2954b77..d5c37781 100644 --- a/manifests/candlepin.pp +++ b/manifests/candlepin.pp @@ -15,8 +15,6 @@ # Whether to connect using SSL # @param db_ssl_verify # Whether to verify the certificate of the database host -# @param manage_db -# Whether to manage the database. Set this to false when using a remote database class katello::candlepin ( Stdlib::Host $db_host = 'localhost', Optional[Stdlib::Port] $db_port = undef, @@ -25,7 +23,6 @@ Optional[String] $db_password = undef, Boolean $db_ssl = false, Boolean $db_ssl_verify = true, - Boolean $manage_db = true, ) { include certs include katello::params @@ -63,7 +60,7 @@ db_password => $db_password, db_ssl => $db_ssl, db_ssl_verify => $db_ssl_verify, - manage_db => $manage_db, + manage_db => $katello::params::manage_db, subscribe => Class['certs', 'certs::candlepin'], } -> anchor { 'katello::candlepin': } diff --git a/manifests/params.pp b/manifests/params.pp index 09a65723..8c444475 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -12,6 +12,8 @@ # The host to run Candlepin as # @param candlepin_url # The URL to connect to Candlepin +# @param manage_db +# Whether to manage the database. Set this to false when using a remote database # @param pulp_url # The URL to connect to Pulp # @param crane_url @@ -22,6 +24,10 @@ # The oauth key for Candlepin # @param candlepin_oauth_secret # The oauth secret for Candlepin +# @param scl_postgresql +# The scl name for PostgreSQL +# @param postgresql_evr_package +# The contextual package name for the PostgreSQL EVR extension class katello::params ( Stdlib::HTTPSUrl $pulp_url = "https://${facts['fqdn']}/pulp/api/v2/", Stdlib::HTTPSUrl $crane_url = "https://${facts['fqdn']}:5000", @@ -29,6 +35,9 @@ String[1] $candlepin_oauth_key = $katello::globals::candlepin_oauth_key, String[1] $candlepin_oauth_secret = $katello::globals::candlepin_oauth_secret, Stdlib::Host $candlepin_host = 'localhost', - Stdlib::HTTPSUrl $candlepin_url = "https://${candlepin_host}:8443/candlepin" + Stdlib::HTTPSUrl $candlepin_url = "https://${candlepin_host}:8443/candlepin", + Boolean $manage_db = true, + String[1] $scl_postgresql = 'rh-postgresql12', + String[1] $postgresql_evr_package = "postgresql-evr-0.0.1-2.el${$::os['release']['major']}.x86_64" ) inherits katello::globals { } diff --git a/spec/classes/application_spec.rb b/spec/classes/application_spec.rb index 38846be3..dc9d338b 100644 --- a/spec/classes/application_spec.rb +++ b/spec/classes/application_spec.rb @@ -18,6 +18,7 @@ class { 'katello::params': it { is_expected.to compile.with_all_deps } it { is_expected.to create_package('tfm-rubygem-katello') } it { is_expected.not_to create_package('tfm-rubygem-katello').that_requires('Anchor[katello::candlepin]') } + it { is_expected.to create_package('rh-postgresql12-postgresql-evr') } it { is_expected.to contain_class('certs::qpid') } it { is_expected.to contain_class('katello::qpid_client') }