Skip to content

Commit b5f80d6

Browse files
authored
Merge pull request #330 from vchepkov/upgrade-agent-status
add parameter for setting final state of infrastructure agents after upgrade
2 parents 4e2b06e + 7742aeb commit b5f80d6

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

Diff for: plans/subplans/configure.pp

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@
150150
)
151151
}
152152

153-
# Ensure Puppet agent service is running now that configuration is complete
153+
# Configure Puppet agent service status now that configuration is complete
154154
$systemctl_state = $final_agent_state ? {
155155
'running' => 'start',
156156
'stopped' => 'stop'

Diff for: plans/upgrade.pp

+14-6
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
# specified, PEAdm will attempt to download PE installation media from its
1717
# standard public source. When specified, PEAdm will download directly from the
1818
# URL given.
19+
# @param final_agent_state
20+
# Configures the state the puppet agent should be in on infrastructure nodes
21+
# after PE is upgraded successfully.
1922
#
2023
plan peadm::upgrade (
2124
# Standard
@@ -37,10 +40,11 @@
3740
Optional[String] $internal_compiler_b_pool_address = undef,
3841

3942
# Other
40-
Optional[String] $token_file = undef,
41-
String $stagingdir = '/tmp',
42-
Enum[direct,bolthost] $download_mode = 'bolthost',
43-
Boolean $permit_unsafe_versions = false,
43+
Optional[String] $token_file = undef,
44+
String $stagingdir = '/tmp',
45+
Enum['running', 'stopped'] $final_agent_state = 'running',
46+
Enum[direct,bolthost] $download_mode = 'bolthost',
47+
Boolean $permit_unsafe_versions = false,
4448

4549
Optional[Enum[
4650
'upgrade-primary',
@@ -349,9 +353,13 @@
349353
}
350354

351355
peadm::plan_step('finalize') || {
352-
# Ensure Puppet running on all infrastructure targets
356+
$service_state = $final_agent_state ? {
357+
'running' => 'start',
358+
'stopped' => 'stop'
359+
}
360+
# Configure Puppet agent service status on all infrastructure targets
353361
run_task('service', $all_targets,
354-
action => 'start',
362+
action => $service_state,
355363
name => 'puppet',
356364
)
357365
}

0 commit comments

Comments
 (0)