Skip to content

Commit

Permalink
(PE-12001) Ensure pe-puppet/mcollective services stopped
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jpartlow committed Sep 25, 2015
1 parent 5c2d39d commit 64901e6
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
5 changes: 5 additions & 0 deletions manifests/service.pp
Expand Up @@ -14,4 +14,9 @@
hasrestart => true,
}
}

if $::operatingsystem == 'Solaris' {
contain '::puppet_agent::service::solaris'
Service[$::puppet_agent::service_names] -> Class['::puppet_agent::service::solaris']
}
}
17 changes: 17 additions & 0 deletions 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,
}
}
}
4 changes: 4 additions & 0 deletions spec/classes/puppet_agent_osfamily_solaris_spec.rb
Expand Up @@ -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
Expand All @@ -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',
Expand Down

0 comments on commit 64901e6

Please sign in to comment.