Merge pull request #539 from juniorsysadmin/allow-unmanaged-service

MODULES-1522 Add service_manage parameter
This commit is contained in:
Colleen Murphy 2014-12-05 10:00:43 -08:00
commit 01211bbb48
5 changed files with 45 additions and 23 deletions

View file

@ -393,6 +393,9 @@ Value to pass through to the `package` resource when creating the server instanc
####`plperl_package_name`
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`
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.

View file

@ -12,6 +12,7 @@ class postgresql::params inherits postgresql::globals {
$locale = $locale
$service_ensure = 'running'
$service_enable = true
$service_manage = true
$service_provider = $service_provider
$manage_pg_hba_conf = pick($manage_pg_hba_conf, true)
$manage_pg_ident_conf = pick($manage_pg_ident_conf, true)

View file

@ -10,6 +10,7 @@ class postgresql::server (
$service_ensure = $postgresql::params::service_ensure,
$service_enable = $postgresql::params::service_enable,
$service_manage = $postgresql::params::service_manage,
$service_name = $postgresql::params::service_name,
$service_provider = $postgresql::params::service_provider,
$service_status = $postgresql::params::service_status,

View file

@ -2,6 +2,7 @@
class postgresql::server::service {
$service_ensure = $postgresql::server::service_ensure
$service_enable = $postgresql::server::service_enable
$service_manage = $postgresql::server::service_manage
$service_name = $postgresql::server::service_name
$service_provider = $postgresql::server::service_provider
$service_status = $postgresql::server::service_status
@ -11,6 +12,8 @@ class postgresql::server::service {
anchor { 'postgresql::server::service::begin': }
if $service_manage {
service { 'postgresqld':
ensure => $service_ensure,
enable => $service_enable,
@ -37,6 +40,7 @@ class postgresql::server::service {
before => Anchor['postgresql::server::service::end']
}
}
}
anchor { 'postgresql::server::service::end': }
}

View file

@ -39,6 +39,19 @@ describe 'postgresql::server', :type => :class do
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
let(:params) do
{