Skip to content

Commit c875d7c

Browse files
authored
Merge pull request #59 from sirinek/windows_provider
add "update_provider" variable to plan
2 parents 4b2f39e + 893f905 commit c875d7c

4 files changed

Lines changed: 40 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ All notable changes to this project will be documented in this file.
1212

1313
Contributed by Haroon Rafique
1414

15+
* Added new configuration option:
16+
* `patching_update_provider`: Parameter sets the provider in the update tasks.
17+
18+
Contributed by Bill Sirinek (@sirinek)
19+
1520
## Release 1.1.0 (2020-04-15)
1621

1722
* Added new plans `patching::get_facts` to retrieve a set of facts from a list of targets

REFERENCE_CONFIGURATION.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
- [patching_snapshot_description](#patching_snapshot_description)
2929
- [patching_snapshot_memory](#patching_snapshot_memory)
3030
- [patching_snapshot_quiesce](#patching_snapshot_quiesce)
31+
- [patching_update_provider](#patching_update_provider)
3132
- [vsphere_host](#vsphere_host)
3233
- [vsphere_username](#vsphere_username)
3334
- [vsphere_password](#vsphere_password)
@@ -566,6 +567,14 @@ default: true
566567

567568
Enable or disable quiescing the VM's filesystem when creating snapshots during patching.
568569

570+
### patching_update_provider
571+
572+
``` yaml
573+
type: String
574+
default: <none>
575+
```
576+
577+
569578
### vsphere_host
570579

571580
``` yaml

plans/available_updates.pp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@
2929
# @param [Boolean] noop
3030
# Run this plan in noop mode, meaning no changes will be made to end systems.
3131
# In this case, noop mode has no effect.
32+
# @param [Optional[String]] provider
33+
# What update provider to use. For Linux (RHEL, Debian, SUSE, etc.) this parameter
34+
# is not used. For Windows the available values are: 'windows', 'chocolatey', 'all'
35+
# (both 'windows' and 'chocolatey'). The default value for Windows is 'all'. If 'all'
36+
# is passed and Chocolatey isn't installed then Chocolatey will simply be skipped.
37+
# If 'chocolatey' is passed and Chocolatey isn't installed, then this will error.
3238
#
3339
# @example CLI - Basic Usage
3440
# bolt plan run patching::available_updates --targets linux_hosts
@@ -46,11 +52,13 @@
4652
plan patching::available_updates (
4753
TargetSpec $targets,
4854
# TODO JSON
49-
Enum['none', 'pretty', 'csv'] $format = 'pretty',
50-
Boolean $noop = false,
55+
Enum['none', 'pretty', 'csv'] $format = 'pretty',
56+
Boolean $noop = false,
57+
Optional[String] $provider = undef,
5158
) {
5259
$available_results = run_task('patching::available_updates', $targets,
53-
_noop => $noop)
60+
provider => $provider,
61+
_noop => $noop)
5462
case $format {
5563
'none': {
5664
return($available_results)

plans/init.pp

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@
2727
# Name of the plan to use for disabling/enabling monitoring steps of the workflow.
2828
# To configure this globally, use the `patching_monitoring_plan` var.
2929
#
30+
# @param [Optional[String]] update_provider
31+
# What update provider to use. For Linux (RHEL, Debian, SUSE, etc.) this parameter
32+
# is not used. For Windows the available values are: 'windows', 'chocolatey', 'all'
33+
# (both 'windows' and 'chocolatey'). The default value for Windows is 'all'. If 'all'
34+
# is passed and Chocolatey isn't installed then Chocolatey will simply be skipped.
35+
# If 'chocolatey' is passed and Chocolatey isn't installed, then this will error.
36+
#
3037
# @param [Optional[String]] pre_update_plan
3138
# Name of the plan to use for executing the pre-update step of the workflow.
3239
#
@@ -108,6 +115,7 @@
108115
Optional[Boolean] $monitoring_enabled = undef,
109116
Optional[String] $monitoring_plan = undef,
110117
Optional[String] $pre_update_plan = undef,
118+
Optional[String] $update_provider = undef,
111119
Optional[String] $post_update_plan = undef,
112120
Optional[Enum['only_required', 'never', 'always']] $reboot_strategy = undef,
113121
Optional[String] $reboot_message = undef,
@@ -165,6 +173,9 @@
165173
$reboot_message_group = pick($reboot_message,
166174
$group_vars['patching_reboot_message'],
167175
'NOTICE: This system is currently being updated.')
176+
$update_provider_group = pick_default($update_provider,
177+
$group_vars['patching_update_provider'],
178+
undef)
168179
$reboot_wait_group = pick($reboot_wait,
169180
$group_vars['patching_reboot_wait'],
170181
300)
@@ -192,8 +203,9 @@
192203

193204
## Check for updates on hosts
194205
$available_results = run_plan('patching::available_updates', $ordered_targets,
195-
format => 'pretty',
196-
noop => $noop)
206+
provider => $update_provider_group,
207+
format => 'pretty',
208+
noop => $noop)
197209
$update_targets = $available_results['has_updates']
198210
if $update_targets.empty {
199211
next()
@@ -219,6 +231,7 @@
219231

220232
## Run package update.
221233
$update_result = run_task('patching::update', $update_targets,
234+
provider => $update_provider_group,
222235
_catch_errors => true,
223236
_noop => $noop)
224237

0 commit comments

Comments
 (0)