Skip to content

Commit 8282399

Browse files
committed
Added a disconnect_wait input to be passed to the reboot plan so that users can better control how long the plan waits before checking to see if the server has rebooted properly
1 parent 127e64a commit 8282399

2 files changed

Lines changed: 19 additions & 4 deletions

File tree

plans/init.pp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@
6060
# 2. A later group is a linux router. In this instance maybe the patching of the linux router
6161
# affects the reachability of previous hosts.
6262
#
63+
# @param [Integer] disconnect_wait How long (in seconds) to wait before checking whether the server has rebooted. Defaults to 10.
64+
#
6365
# @param [Optional[String]] snapshot_plan
6466
# Name of the plan to use for executing snaphot creation and deletion steps of the workflow
6567
# You can also pass `'disabled'` or `undef'` as an easy way to disable both creation and deletion.
@@ -120,6 +122,7 @@
120122
Optional[Enum['only_required', 'never', 'always']] $reboot_strategy = undef,
121123
Optional[String] $reboot_message = undef,
122124
Optional[Integer] $reboot_wait = undef,
125+
Optional[Integer] $disconnect_wait = undef,
123126
Optional[String] $snapshot_plan = undef,
124127
Optional[Boolean] $snapshot_create = undef,
125128
Optional[Boolean] $snapshot_delete = undef,
@@ -194,6 +197,9 @@
194197
$snapshot_delete_group = pick($snapshot_delete,
195198
$group_vars['patching_snapshot_delete'],
196199
true)
200+
$disconnect_wait_group = pick($disconnect_wait,
201+
$group_vars['patching_disconnect_wait'],
202+
10)
197203

198204
# do normal patching
199205

@@ -257,10 +263,11 @@
257263

258264
## Check if reboot required and reboot if true.
259265
run_plan('patching::reboot_required', $update_ok_targets,
260-
strategy => $reboot_strategy_group,
261-
message => $reboot_message_group,
262-
wait => $reboot_wait_group,
263-
noop => $noop)
266+
strategy => $reboot_strategy_group,
267+
message => $reboot_message_group,
268+
wait => $reboot_wait_group,
269+
disconnect_wait => $disconnect_wait_group,
270+
noop => $noop)
264271

265272
## Remove VM snapshots
266273
if $snapshot_delete_group and $snapshot_plan_group and $snapshot_plan_group != 'disabled' {

plans/reboot_required.pp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
# 2. A later group is a linux router. In this instance maybe the patching of the linux router
3131
# affects the reachability of previous hosts.
3232
#
33+
# @param [Integer] disconnect_wait How long (in seconds) to wait before checking whether the server has rebooted. Defaults to 10.
34+
#
3335
# @param [Boolean] noop
3436
# Flag to determine if this should be a noop operation or not.
3537
# If this is a noop, no hosts will ever be rebooted, however the "reboot required" information
@@ -47,6 +49,7 @@
4749
Enum['only_required', 'never', 'always'] $strategy = undef,
4850
String $message = undef,
4951
Integer $wait = undef,
52+
Integer $disconnect_wait = undef,
5053
Boolean $noop = false,
5154
) {
5255
$_targets = run_plan('patching::get_targets', $targets)
@@ -60,6 +63,9 @@
6063
$_wait = pick($wait,
6164
$group_vars['patching_reboot_wait'],
6265
300)
66+
$_disconnect_wait = pick($disconnect_wait,
67+
$group_vars['patching_disconnect_wait'],
68+
10)
6369

6470
## Check if reboot required.
6571
$reboot_results = run_task('patching::reboot_required', $_targets)
@@ -83,6 +89,7 @@
8389
$targets_reboot_attempted = $targets_reboot_required
8490
$reboot_resultset = run_plan('reboot', $targets_reboot_required,
8591
reconnect_timeout => $_wait,
92+
disconnect_wait => $_disconnect_wait,
8693
message => $_message,
8794
_catch_errors => true)
8895
}
@@ -95,6 +102,7 @@
95102
$targets_reboot_attempted = $targets
96103
$reboot_resultset = run_plan('reboot', $targets,
97104
reconnect_timeout => $_wait,
105+
disconnect_wait => $_disconnect_wait,
98106
message => $_message,
99107
_catch_errors => true)
100108
}

0 commit comments

Comments
 (0)