From 64901e6d4323353019b21faa7e848fb682a3ced2 Mon Sep 17 00:00:00 2001 From: Josh Partlow Date: Thu, 24 Sep 2015 17:31:04 -0700 Subject: [PATCH] (PE-12001) Ensure pe-puppet/mcollective services stopped Removing the PUPpuppet and PUPmcollective packages does not stop the running services. I've added service resources for both of the old PE services to ensure they are stopped. However, it is also critical that they are stopped as the very last act of the catalog, because stopping the pe-puppet service, at least on Solaris, terminates the run in mid progress. Originally I had the services stopped in the prepare stage, but had to reposition them. --- manifests/service.pp | 5 +++++ manifests/service/solaris.pp | 17 +++++++++++++++++ .../puppet_agent_osfamily_solaris_spec.rb | 4 ++++ 3 files changed, 26 insertions(+) create mode 100644 manifests/service/solaris.pp diff --git a/manifests/service.pp b/manifests/service.pp index 91773612b..b14e6c6d4 100644 --- a/manifests/service.pp +++ b/manifests/service.pp @@ -14,4 +14,9 @@ hasrestart => true, } } + + if $::operatingsystem == 'Solaris' { + contain '::puppet_agent::service::solaris' + Service[$::puppet_agent::service_names] -> Class['::puppet_agent::service::solaris'] + } } diff --git a/manifests/service/solaris.pp b/manifests/service/solaris.pp new file mode 100644 index 000000000..507bf0796 --- /dev/null +++ b/manifests/service/solaris.pp @@ -0,0 +1,17 @@ +# == Class puppet_agent::service::solaris +# +# This class tidies up the pe-puppet and pe-mcollective services +# which are left running after package removal on Solaris 10. +# +class puppet_agent::service::solaris { + assert_private() + + if $::operatingsystem == 'Solaris' and $::operatingsystemmajrelease == '10' { + service { 'pe-mcollective': + ensure => stopped, + } + service { 'pe-puppet': + ensure => stopped, + } + } +} diff --git a/spec/classes/puppet_agent_osfamily_solaris_spec.rb b/spec/classes/puppet_agent_osfamily_solaris_spec.rb index d180c3a98..d33679990 100644 --- a/spec/classes/puppet_agent_osfamily_solaris_spec.rb +++ b/spec/classes/puppet_agent_osfamily_solaris_spec.rb @@ -57,6 +57,7 @@ }) end + it { should compile.with_all_deps } it { is_expected.to contain_file('/opt/puppetlabs') } it { is_expected.to contain_file('/opt/puppetlabs/packages') } it do @@ -70,6 +71,9 @@ is_expected.to contain_exec('unzip puppet-agent-1.2.5-1.i386.pkg.gz').with_creates('/opt/puppetlabs/packages/puppet-agent-1.2.5-1.i386.pkg') end + it { is_expected.to contain_service('pe-puppet').with_ensure('stopped') } + it { is_expected.to contain_service('pe-mcollective').with_ensure('stopped') } + [ 'PUPpuppet', 'PUPaugeas',