Skip to content

Commit

Permalink
Merge pull request #84 from EncoreTechnologies/feature/reboot-disconn…
Browse files Browse the repository at this point in the history
…ect-wait

Feature/reboot disconnect wait
  • Loading branch information
nmaludy authored Jul 7, 2021
2 parents 1b41cee + 4d0bae2 commit 5f70b9b
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 5 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ All notable changes to this project will be documented in this file.
Contributed by Vadym Chepkov (@vchepkov)


## Release 1.5.0 (2021-06-20)

* Added disconnect_wait input to be passed to the reboot plan so that
there can be controls around when the plan checks if the server has
rebooted.

Contributed by Bradley Bishop (@bishopbm1)

## Release 1.4.0 (2021-04-30)

* Added a new plan and task `patching::snapshot_kvm` for creating/deleting
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "encore-patching",
"version": "1.4.0",
"version": "1.5.0",
"author": "Encore Technologies",
"summary": "Implements OS patching workflows using Bolt tasks and plans.",
"license": "Apache-2.0",
Expand Down
15 changes: 11 additions & 4 deletions plans/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@
# 2. A later group is a linux router. In this instance maybe the patching of the linux router
# affects the reachability of previous hosts.
#
# @param [Integer] disconnect_wait How long (in seconds) to wait before checking whether the server has rebooted. Defaults to 10.
#
# @param [Optional[String]] snapshot_plan
# Name of the plan to use for executing snaphot creation and deletion steps of the workflow
# You can also pass `'disabled'` or `undef'` as an easy way to disable both creation and deletion.
Expand Down Expand Up @@ -120,6 +122,7 @@
Optional[Enum['only_required', 'never', 'always']] $reboot_strategy = undef,
Optional[String] $reboot_message = undef,
Optional[Integer] $reboot_wait = undef,
Optional[Integer] $disconnect_wait = undef,
Optional[String] $snapshot_plan = undef,
Optional[Boolean] $snapshot_create = undef,
Optional[Boolean] $snapshot_delete = undef,
Expand Down Expand Up @@ -194,6 +197,9 @@
$snapshot_delete_group = pick($snapshot_delete,
$group_vars['patching_snapshot_delete'],
true)
$disconnect_wait_group = pick($disconnect_wait,
$group_vars['patching_disconnect_wait'],
10)

# do normal patching

Expand Down Expand Up @@ -257,10 +263,11 @@

## Check if reboot required and reboot if true.
run_plan('patching::reboot_required', $update_ok_targets,
strategy => $reboot_strategy_group,
message => $reboot_message_group,
wait => $reboot_wait_group,
noop => $noop)
strategy => $reboot_strategy_group,
message => $reboot_message_group,
wait => $reboot_wait_group,
disconnect_wait => $disconnect_wait_group,
noop => $noop)

## Remove VM snapshots
if $snapshot_delete_group and $snapshot_plan_group and $snapshot_plan_group != 'disabled' {
Expand Down
8 changes: 8 additions & 0 deletions plans/reboot_required.pp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
# 2. A later group is a linux router. In this instance maybe the patching of the linux router
# affects the reachability of previous hosts.
#
# @param [Integer] disconnect_wait How long (in seconds) to wait before checking whether the server has rebooted. Defaults to 10.
#
# @param [Boolean] noop
# Flag to determine if this should be a noop operation or not.
# If this is a noop, no hosts will ever be rebooted, however the "reboot required" information
Expand All @@ -47,6 +49,7 @@
Enum['only_required', 'never', 'always'] $strategy = undef,
String $message = undef,
Integer $wait = undef,
Integer $disconnect_wait = undef,
Boolean $noop = false,
) {
$_targets = run_plan('patching::get_targets', $targets)
Expand All @@ -60,6 +63,9 @@
$_wait = pick($wait,
$group_vars['patching_reboot_wait'],
300)
$_disconnect_wait = pick($disconnect_wait,
$group_vars['patching_disconnect_wait'],
10)

## Check if reboot required.
$reboot_results = run_task('patching::reboot_required', $_targets)
Expand All @@ -83,6 +89,7 @@
$targets_reboot_attempted = $targets_reboot_required
$reboot_resultset = run_plan('reboot', $targets_reboot_required,
reconnect_timeout => $_wait,
disconnect_wait => $_disconnect_wait,
message => $_message,
_catch_errors => true)
}
Expand All @@ -95,6 +102,7 @@
$targets_reboot_attempted = $targets
$reboot_resultset = run_plan('reboot', $targets,
reconnect_timeout => $_wait,
disconnect_wait => $_disconnect_wait,
message => $_message,
_catch_errors => true)
}
Expand Down

0 comments on commit 5f70b9b

Please sign in to comment.