Skip to content

Commit 07a868e

Browse files
Merge pull request puppetlabs#1167 from puppetlabs/ensure_value
service_ensure => true is now an allowed value (aliased to running)
2 parents 22bf0bc + e4bac1c commit 07a868e

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

Diff for: manifests/server/service.pp

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
status => $service_status,
2626
}
2727

28-
if $service_ensure == 'running' {
28+
if $service_ensure in ['running', true] {
2929
# This blocks the class before continuing if chained correctly, making
3030
# sure the service really is 'up' before continuing.
3131
#

Diff for: spec/unit/classes/server_spec.rb

+22
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,28 @@
5757
end
5858
end
5959

60+
describe 'service_ensure => true' do
61+
let(:params) do
62+
{
63+
service_ensure: true,
64+
postgres_password: 'new-p@s$word-to-set',
65+
}
66+
end
67+
68+
it { is_expected.to contain_class('postgresql::params') }
69+
it { is_expected.to contain_class('postgresql::server') }
70+
it { is_expected.to contain_class('postgresql::server::passwd') }
71+
it 'validates connection' do
72+
is_expected.to contain_postgresql_conn_validator('validate_service_is_running')
73+
end
74+
it 'sets postgres password' do
75+
is_expected.to contain_exec('set_postgres_postgrespw').with('command' => '/usr/bin/psql -c "ALTER ROLE \"postgres\" PASSWORD ${NEWPASSWD_ESCAPED}"',
76+
'user' => 'postgres',
77+
'environment' => ['PGPASSWORD=new-p@s$word-to-set', 'PGPORT=5432', 'NEWPASSWD_ESCAPED=$$new-p@s$word-to-set$$'],
78+
'unless' => "/usr/bin/psql -h localhost -p 5432 -c 'select 1' > /dev/null")
79+
end
80+
end
81+
6082
describe 'service_ensure => stopped' do
6183
let(:params) { { service_ensure: 'stopped' } }
6284

0 commit comments

Comments
 (0)