From d7ffbc326a8172bb0d0ecb888ed12d2c7e3eb7fd Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Wed, 10 Oct 2012 16:41:44 -0700 Subject: Add manage_service parameter for corosync --- manifests/init.pp | 35 +++++++++++++++++++---------------- spec/classes/haproxy_spec.rb | 20 ++++++++++++++++++++ 2 files changed, 39 insertions(+), 16 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index c36b1ae..7bf6aa9 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -64,6 +64,7 @@ # Gary Larizza # class haproxy ( + $manage_service = true, $enable = true, $haproxy_global_options = $haproxy::data::haproxy_global_options, $haproxy_defaults_options = $haproxy::data::haproxy_defaults_options @@ -116,21 +117,23 @@ class haproxy ( } - service { 'haproxy': - ensure => $enable ? { - true => running, - false => stopped, - }, - enable => $enable ? { - true => true, - false => false, - }, - name => 'haproxy', - hasrestart => true, - hasstatus => true, - require => [ - Concat['/etc/haproxy/haproxy.cfg'], - File[$haproxy_global_options['chroot']], - ], + if $manage_service { + service { 'haproxy': + ensure => $enable ? { + true => running, + false => stopped, + }, + enable => $enable ? { + true => true, + false => false, + }, + name => 'haproxy', + hasrestart => true, + hasstatus => true, + require => [ + Concat['/etc/haproxy/haproxy.cfg'], + File[$haproxy_global_options['chroot']], + ], + } } } diff --git a/spec/classes/haproxy_spec.rb b/spec/classes/haproxy_spec.rb index fa171f3..4b5902c 100644 --- a/spec/classes/haproxy_spec.rb +++ b/spec/classes/haproxy_spec.rb @@ -83,6 +83,26 @@ describe 'haproxy', :type => :class do end end end + context "on #{osfamily} family operatingsystems without managing the service" do + let(:facts) do + { :osfamily => osfamily }.merge default_facts + end + let(:params) do + { + 'enable' => true, + 'manage_service' => false, + } + end + it { should include_class('concat::setup') } + it 'should install the haproxy package' do + subject.should contain_package('haproxy').with( + 'ensure' => 'present' + ) + end + it 'should install the haproxy service' do + subject.should_not contain_service('haproxy') + end + end end end describe 'for OS-specific configuration' do -- cgit v1.2.3