Add service_manage parameter
Loosely addresses MODULES-1522
This commit is contained in:
parent
61f86551d8
commit
789543fc45
5 changed files with 45 additions and 23 deletions
|
@ -393,6 +393,9 @@ Value to pass through to the `package` resource when creating the server instanc
|
||||||
####`plperl_package_name`
|
####`plperl_package_name`
|
||||||
This sets the default package name for the PL/Perl extension. Defaults to utilising the operating system default.
|
This sets the default package name for the PL/Perl extension. Defaults to utilising the operating system default.
|
||||||
|
|
||||||
|
####`service_manage`
|
||||||
|
This setting selects whether Puppet should manage the service. Defaults to `true`.
|
||||||
|
|
||||||
####`service_name`
|
####`service_name`
|
||||||
This setting can be used to override the default postgresql service name. If not specified, the module will use whatever service name is the default for your OS distro.
|
This setting can be used to override the default postgresql service name. If not specified, the module will use whatever service name is the default for your OS distro.
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ class postgresql::params inherits postgresql::globals {
|
||||||
$locale = $locale
|
$locale = $locale
|
||||||
$service_ensure = 'running'
|
$service_ensure = 'running'
|
||||||
$service_enable = true
|
$service_enable = true
|
||||||
|
$service_manage = true
|
||||||
$service_provider = $service_provider
|
$service_provider = $service_provider
|
||||||
$manage_pg_hba_conf = pick($manage_pg_hba_conf, true)
|
$manage_pg_hba_conf = pick($manage_pg_hba_conf, true)
|
||||||
$manage_pg_ident_conf = pick($manage_pg_ident_conf, true)
|
$manage_pg_ident_conf = pick($manage_pg_ident_conf, true)
|
||||||
|
|
|
@ -10,6 +10,7 @@ class postgresql::server (
|
||||||
|
|
||||||
$service_ensure = $postgresql::params::service_ensure,
|
$service_ensure = $postgresql::params::service_ensure,
|
||||||
$service_enable = $postgresql::params::service_enable,
|
$service_enable = $postgresql::params::service_enable,
|
||||||
|
$service_manage = $postgresql::params::service_manage,
|
||||||
$service_name = $postgresql::params::service_name,
|
$service_name = $postgresql::params::service_name,
|
||||||
$service_provider = $postgresql::params::service_provider,
|
$service_provider = $postgresql::params::service_provider,
|
||||||
$service_status = $postgresql::params::service_status,
|
$service_status = $postgresql::params::service_status,
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
class postgresql::server::service {
|
class postgresql::server::service {
|
||||||
$service_ensure = $postgresql::server::service_ensure
|
$service_ensure = $postgresql::server::service_ensure
|
||||||
$service_enable = $postgresql::server::service_enable
|
$service_enable = $postgresql::server::service_enable
|
||||||
|
$service_manage = $postgresql::server::service_manage
|
||||||
$service_name = $postgresql::server::service_name
|
$service_name = $postgresql::server::service_name
|
||||||
$service_provider = $postgresql::server::service_provider
|
$service_provider = $postgresql::server::service_provider
|
||||||
$service_status = $postgresql::server::service_status
|
$service_status = $postgresql::server::service_status
|
||||||
|
@ -11,6 +12,8 @@ class postgresql::server::service {
|
||||||
|
|
||||||
anchor { 'postgresql::server::service::begin': }
|
anchor { 'postgresql::server::service::begin': }
|
||||||
|
|
||||||
|
if $service_manage {
|
||||||
|
|
||||||
service { 'postgresqld':
|
service { 'postgresqld':
|
||||||
ensure => $service_ensure,
|
ensure => $service_ensure,
|
||||||
enable => $service_enable,
|
enable => $service_enable,
|
||||||
|
@ -37,6 +40,7 @@ class postgresql::server::service {
|
||||||
before => Anchor['postgresql::server::service::end']
|
before => Anchor['postgresql::server::service::end']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
anchor { 'postgresql::server::service::end': }
|
anchor { 'postgresql::server::service::end': }
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,19 @@ describe 'postgresql::server', :type => :class do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe 'service_manage => true' do
|
||||||
|
let(:params) {{ :service_manage => true }}
|
||||||
|
it { is_expected.to contain_service('postgresqld') }
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'service_manage => false' do
|
||||||
|
let(:params) {{ :service_manage => false }}
|
||||||
|
it { is_expected.not_to contain_service('postgresqld') }
|
||||||
|
it 'shouldnt validate connection' do
|
||||||
|
is_expected.not_to contain_postgresql__validate_db_connection('validate_service_is_running')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe 'package_ensure => absent' do
|
describe 'package_ensure => absent' do
|
||||||
let(:params) do
|
let(:params) do
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue