Skip to content

Commit

Permalink
add parameter to overwrite service management
Browse files Browse the repository at this point in the history
  • Loading branch information
trefzer committed Nov 22, 2021
1 parent 576f607 commit 76ced1a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
1 change: 1 addition & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
Optional[Stdlib::Absolutepath] $ssl_cert = undef,
Optional[Stdlib::Absolutepath] $ssl_key = undef,
Optional[String] $ssl_protocol = undef,
Optional[Boolean] $manage_service = undef,
) {
if ($community_modules != []) {
class { 'prosody::community_modules':
Expand Down
2 changes: 1 addition & 1 deletion manifests/service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Optional[String] $restart = undef,
) {

if $prosody::daemonize {
if pick($prosody::manage_service, $prosody::daemonize) {
service { 'prosody':
ensure => running,
enable => true,
Expand Down
25 changes: 25 additions & 0 deletions spec/classes/service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,31 @@

it_behaves_like 'prosody::service with defaults'
end

context 'with manage=> true' do
let(:pre_condition) do
'class {"prosody":
manage_service => true
}'
end

it {
is_expected.to contain_service('prosody')
.with_ensure('running')
.with_enable(true)
}
end
context 'with manage => false' do
let(:pre_condition) do
'class {"prosody":
manage_service => false
}'
end

it {
is_expected.not_to contain_service('prosody')
}
end
end
end
end

0 comments on commit 76ced1a

Please sign in to comment.