diff --git a/.fixtures.yml b/.fixtures.yml index fbee13667e..490615ba52 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -4,11 +4,15 @@ fixtures: apt: "https://github.com/puppetlabs/puppetlabs-apt.git" augeas_core: "https://github.com/puppetlabs/puppetlabs-augeas_core.git" concat: "https://github.com/puppetlabs/puppetlabs-concat.git" - cron_core: "https://github.com/puppetlabs/puppetlabs-cron_core.git" + cron_core: + repo: "https://github.com/puppetlabs/puppetlabs-cron_core.git" + ref: "v1.3.0" facts: 'https://github.com/puppetlabs/puppetlabs-facts.git' firewall: "https://github.com/puppetlabs/puppetlabs-firewall.git" provision: "https://github.com/puppetlabs/provision.git" puppet_agent: 'https://github.com/puppetlabs/puppetlabs-puppet_agent.git' stdlib: "https://github.com/puppetlabs/puppetlabs-stdlib.git" - yumrepo_core: "https://github.com/puppetlabs/puppetlabs-yumrepo_core.git" + yumrepo_core: + repo: "https://github.com/puppetlabs/puppetlabs-yumrepo_core.git" + ref: "v2.1.0" systemd: "https://github.com/voxpupuli/puppet-systemd.git" diff --git a/manifests/params.pp b/manifests/params.pp index 55dcd24c0f..41308acc8f 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -86,7 +86,7 @@ } $service_reload = "systemctl reload ${service_name}" - $service_status = pick($service_status, "systemctl status ${service_name}") + $service_status = pick($service_status, "systemctl is-active --quiet ${service_name}") $psql_path = pick($psql_path, "${bindir}/psql") @@ -130,7 +130,7 @@ $confdir = pick($confdir, $datadir) $psql_path = pick($psql_path, "${bindir}/psql") - $service_status = pick($service_status, "systemctl status ${service_name}") + $service_status = pick($service_status, "systemctl is-active --quiet ${service_name}") $service_reload = "systemctl reload ${service_name}" $python_package_name = pick($python_package_name, 'python-psycopg2') # Archlinux does not have a perl::DBD::Pg package @@ -173,7 +173,7 @@ $datadir = pick($datadir, "/var/lib/postgresql/${version}/main") $confdir = pick($confdir, "/etc/postgresql/${version}/main") $service_reload = "systemctl reload ${service_name}" - $service_status = pick($service_status, "systemctl status ${service_name}") + $service_status = pick($service_status, "systemctl is-active --quiet ${service_name}") $psql_path = pick($psql_path, '/usr/bin/psql') $postgresql_conf_mode = pick($postgresql_conf_mode, '0644') } @@ -194,7 +194,7 @@ $bindir = pick($bindir, "/usr/lib/postgresql-${version}/bin") $datadir = pick($datadir, "/var/lib/postgresql/${version}_data") $confdir = pick($confdir, "/etc/postgresql-${version}") - $service_status = pick($service_status, "systemctl status ${service_name}") + $service_status = pick($service_status, "systemctl is-active --quiet ${service_name}") $service_reload = "systemctl reload ${service_name}" $psql_path = pick($psql_path, "${bindir}/psql") @@ -267,7 +267,7 @@ $bindir = pick($bindir, "/usr/lib/postgresql${version}/bin") $datadir = pick($datadir, '/var/lib/pgsql/data') $confdir = pick($confdir, $datadir) - $service_status = pick($service_status, "systemctl status ${service_name}") + $service_status = pick($service_status, "systemctl is-active --quiet ${service_name}") $service_reload = "systemctl reload ${service_name}" $psql_path = pick($psql_path, "${bindir}/psql") diff --git a/manifests/server.pp b/manifests/server.pp index 2516e43611..24ff268770 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -130,7 +130,7 @@ Boolean $service_restart_on_change = $postgresql::params::service_restart_on_change, Optional[String[1]] $service_provider = $postgresql::params::service_provider, String[1] $service_reload = $postgresql::params::service_reload, - Optional[String[1]] $service_status = $postgresql::params::service_status, + Optional[Variant[Array[String[1]],String[1]]] $service_status = $postgresql::params::service_status, String[1] $default_database = $postgresql::params::default_database, Hash $default_connect_settings = $postgresql::globals::default_connect_settings, Optional[Variant[String[1], Array[String[1]]]] $listen_addresses = $postgresql::params::listen_addresses, diff --git a/spec/acceptance/server_instance_spec.rb b/spec/acceptance/server_instance_spec.rb index 4b8d6a4bb8..2d22981549 100644 --- a/spec/acceptance/server_instance_spec.rb +++ b/spec/acceptance/server_instance_spec.rb @@ -46,7 +46,7 @@ class { 'postgresql::server': }, service_settings => { 'service_name' => 'postgresql@13-test1', - 'service_status' => 'systemctl status postgresql@13-test1.service', + 'service_status' => 'systemctl is-active --quiet postgresql@13-test1.service', 'service_ensure' => 'running', 'service_enable' => true, }, diff --git a/spec/classes/server/service_spec.rb b/spec/classes/server/service_spec.rb index 1018fbc688..7c308250bb 100644 --- a/spec/classes/server/service_spec.rb +++ b/spec/classes/server/service_spec.rb @@ -10,5 +10,5 @@ end it { is_expected.to contain_class('postgresql::server::service') } - it { is_expected.to contain_service('postgresqld_instance_main').with_name('postgresql').with_status('systemctl status postgresql') } + it { is_expected.to contain_service('postgresqld_instance_main').with_name('postgresql').with_status('systemctl is-active --quiet postgresql') } end diff --git a/spec/defines/server_instance_spec.rb b/spec/defines/server_instance_spec.rb index ea63146fe4..43c018d744 100644 --- a/spec/defines/server_instance_spec.rb +++ b/spec/defines/server_instance_spec.rb @@ -42,7 +42,7 @@ class { 'postgresql::server': 'port' => 5433, 'pg_hba_conf_defaults' => false }, 'service_settings': { 'service_name' => 'postgresql@13-test1', - 'service_status' => 'systemctl status postgresql@13-test1.service', + 'service_status' => 'systemctl is-active --quiet postgresql@13-test1.service', 'service_ensure' => 'running', 'service_enable' => true }, 'initdb_settings': { 'auth_local' => 'peer', @@ -120,7 +120,7 @@ class { 'postgresql::server': it { is_expected.to contain_postgresql__server_instance('test1') } it { is_expected.to contain_user('ins_test1') } it { is_expected.to contain_group('ins_test1') } - it { is_expected.to contain_service('postgresqld_instance_test1').with_name('postgresql@13-test1').with_status('systemctl status postgresql@13-test1.service') } + it { is_expected.to contain_service('postgresqld_instance_test1').with_name('postgresql@13-test1').with_status('systemctl is-active --quiet postgresql@13-test1.service') } it { is_expected.to contain_systemd__dropin_file('postgresql@13-test1.conf') } it { is_expected.to contain_postgresql_conn_validator('validate_service_is_running_instance_test1') } it { is_expected.to contain_postgresql_conf('port_for_instance_test1') }