diff --git a/manifests/init.pp b/manifests/init.pp index 0ccfaf9..0cc335b 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -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': diff --git a/manifests/service.pp b/manifests/service.pp index db98417..7f0e5aa 100644 --- a/manifests/service.pp +++ b/manifests/service.pp @@ -4,7 +4,7 @@ Optional[String] $restart = undef, ) { - if $prosody::daemonize { + if pick($prosody::manage_service, $prosody::daemonize) { service { 'prosody': ensure => running, enable => true, diff --git a/spec/classes/service_spec.rb b/spec/classes/service_spec.rb index 3bec9de..0c57e6a 100644 --- a/spec/classes/service_spec.rb +++ b/spec/classes/service_spec.rb @@ -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