Skip to content

Commit 9a94261

Browse files
committed
Change to run_plan positional parameter for targets
1 parent 1643680 commit 9a94261

13 files changed

Lines changed: 47 additions & 72 deletions

plans/available_updates.pp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,10 @@
3737
# bolt plan run patching::available_updates --targets linux_hosts format=csv
3838
#
3939
# @example Plan - Basic Usage
40-
# run_plan('patching::available_updates',
41-
# targets => $linux_hosts)
40+
# run_plan('patching::available_updates', $linux_hosts)
4241
#
4342
# @example Plan - Get available update information in CSV format for creating reports
44-
# run_plan('patching::available_updates',
45-
# targets => $linux_hosts,
43+
# run_plan('patching::available_updates', $linux_hosts,
4644
# format => 'csv')
4745
#
4846
plan patching::available_updates (

plans/check_puppet.pp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,13 @@
3737
# bolt plan run patching::check_puppet --targets linux_hosts filter_offline_targets=true
3838
#
3939
# @example Plan - Basic usage (error if any targets are offline)
40-
# $results = run_plan('patching::check_puppet',
41-
# targets => $linux_hosts)
40+
# $results = run_plan('patching::check_puppet', $linux_hosts)
4241
# $targets_has_puppet = $results['has_puppet']
4342
# $targets_no_puppet = $results['no_puppet']
4443
# $targets_all = $results['all']
4544
#
4645
# @example Plan - Filter offline targets (only return online targets)
47-
# $results = run_plan('patching::check_puppet',
48-
# targets => $linux_hosts,
46+
# $results = run_plan('patching::check_puppet', $linux_hosts,
4947
# filter_offline_targets => true)
5048
# $targets_online_has_puppet = $results['has_puppet']
5149
# $targets_online_no_puppet = $results['no_puppet']
@@ -74,13 +72,11 @@
7472
if !$targets_with_puppet.empty() {
7573
# run `puppet facts` on targets with Puppet because it returns a more complete
7674
# set of facts than just running `facter`
77-
run_plan('patching::puppet_facts',
78-
targets => $targets_with_puppet)
75+
run_plan('patching::puppet_facts', $targets_with_puppet)
7976
}
8077
if !$targets_no_puppet.empty() {
8178
# run `facter` if it's available otherwise get basic facts
82-
run_plan('facts',
83-
targets => $targets_no_puppet)
79+
run_plan('facts', $targets_no_puppet)
8480
}
8581

8682
return({

plans/deploy_scripts.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
Optional[String] $group = undef,
4242
Optional[String] $mode = undef,
4343
) {
44-
$_targets = run_plan('patching::get_targets', targets => $targets)
44+
$_targets = run_plan('patching::get_targets', $targets)
4545
return apply($_targets) {
4646
include patching::params
4747
class { 'patching':

plans/get_targets.pp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
# plan mymodule::myplan (
2121
# TargetSpec $targets
2222
# ) {
23-
# $targets = run_plan('patching::get_targets', targets => $targets)
23+
# $targets = run_plan('patching::get_targets', $targets)
2424
# # do normal stuff with your $targets
2525
# }
2626
plan patching::get_targets (
@@ -29,7 +29,7 @@
2929
$_targets = get_targets($targets)
3030
$target_first_facts = facts($_targets[0])
3131
if !$target_first_facts['os'] or !$target_first_facts['os']['family'] {
32-
run_plan('patching::check_puppet', targets => $_targets)
32+
run_plan('patching::check_puppet', $_targets)
3333
}
3434
return $_targets
3535
}

plans/init.pp

Lines changed: 22 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,13 @@
109109
Boolean $noop = false,
110110
) {
111111
## Filter offline targets
112-
$check_puppet_result = run_plan('patching::check_puppet',
113-
targets => $targets,
112+
$check_puppet_result = run_plan('patching::check_puppet', $targets,
114113
filter_offline_targets => $filter_offline_targets)
115114
# use all targets, both with and without puppet
116115
$_targets = $check_puppet_result['all']
117116

118117
## Group all of the targets based on their 'patching_order' var
119-
$ordered_groups = run_plan('patching::ordered_groups', targets => $_targets)
118+
$ordered_groups = run_plan('patching::ordered_groups', $_targets)
120119

121120
# we can now use the $ordered_keys array above to index into our $ordered_hash
122121
# pretty cool huh?
@@ -166,8 +165,7 @@
166165
_noop => $noop)
167166

168167
## Check for updates on hosts
169-
$available_results = run_plan('patching::available_updates',
170-
targets => $ordered_targets,
168+
$available_results = run_plan('patching::available_updates', $ordered_targets,
171169
format => 'pretty',
172170
noop => $noop)
173171
$update_targets = $available_results['has_updates']
@@ -177,24 +175,21 @@
177175

178176
## Disable monitoring
179177
if $monitoring_enabled_group and $monitoring_plan_group and $monitoring_plan_group != 'disabled' {
180-
run_plan($monitoring_plan_group,
181-
targets => $update_targets,
182-
action => 'disable',
183-
noop => $noop)
178+
run_plan($monitoring_plan_group, $update_targets,
179+
action => 'disable',
180+
noop => $noop)
184181
}
185182

186183
## Create VM snapshots
187184
if $snapshot_create_group and $snapshot_plan_group and $snapshot_plan_group != 'disabled'{
188-
run_plan($snapshot_plan_group,
189-
targets => $update_targets,
190-
action => 'create',
191-
noop => $noop)
185+
run_plan($snapshot_plan_group, $update_targets,
186+
action => 'create',
187+
noop => $noop)
192188
}
193189

194190
## Run pre-patching script.
195-
run_plan($pre_update_plan_group,
196-
targets => $update_targets,
197-
noop => $noop)
191+
run_plan($pre_update_plan_group, $update_targets,
192+
noop => $noop)
198193

199194
## Run package update.
200195
$update_result = run_task('patching::update', $update_targets,
@@ -218,23 +213,20 @@
218213

219214
if !$update_ok_targets.empty {
220215
## Run post-patching script.
221-
run_plan($post_update_plan_group,
222-
targets => $update_ok_targets,
223-
noop => $noop)
216+
run_plan($post_update_plan_group, $update_ok_targets,
217+
noop => $noop)
224218

225219
## Check if reboot required and reboot if true.
226-
run_plan('patching::reboot_required',
227-
targets => $update_ok_targets,
220+
run_plan('patching::reboot_required', $update_ok_targets,
228221
strategy => $reboot_strategy_group,
229222
message => $reboot_message_group,
230223
noop => $noop)
231224

232225
## Remove VM snapshots
233226
if $snapshot_delete_group and $snapshot_plan_group and $snapshot_plan_group != 'disabled' {
234-
run_plan($snapshot_plan_group,
235-
targets => $update_ok_targets,
236-
action => 'delete',
237-
noop => $noop)
227+
run_plan($snapshot_plan_group, $update_ok_targets,
228+
action => 'delete',
229+
noop => $noop)
238230
}
239231
}
240232
# else {
@@ -243,10 +235,9 @@
243235

244236
## enable monitoring
245237
if $monitoring_enabled_group and $monitoring_plan_group and $monitoring_plan_group != 'disabled' {
246-
run_plan($monitoring_plan_group,
247-
targets => $update_targets,
248-
action => 'enable',
249-
noop => $noop)
238+
run_plan($monitoring_plan_group, $update_targets,
239+
action => 'enable',
240+
noop => $noop)
250241
}
251242
}
252243

@@ -261,9 +252,8 @@
261252
wait_until_available($_targets, wait_time => $reboot_wait)
262253

263254
## Collect summary report
264-
run_plan('patching::update_history',
265-
targets => $_targets,
266-
format => 'pretty')
255+
run_plan('patching::update_history', $_targets,
256+
format => 'pretty')
267257

268258
## Display final status
269259
return()

plans/monitoring_solarwinds.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
Optional[String[1]] $monitoring_name_property = undef,
7979
Boolean $noop = false,
8080
) {
81-
$_targets = run_plan('patching::get_targets', targets => $targets)
81+
$_targets = run_plan('patching::get_targets', $targets)
8282
$group_vars = $_targets[0].vars
8383
$_target_name_property = pick($target_name_property,
8484
$group_vars['patching_monitoring_target_name_property'],

plans/ordered_groups.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
# so we wanted this to be very concrete.
8181
#
8282
# @example Basic usage
83-
# $ordered_groups = run_plan('patching::ordered_groups', targets => $targets)
83+
# $ordered_groups = run_plan('patching::ordered_groups', $targets)
8484
# $ordered_groups.each |$group_hash| {
8585
# $group_order = $group_hash['order']
8686
# $group_targets = $group_hash['targets']

plans/post_update.pp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,10 @@
5252
# bolt plan run patching::post_update --targets all_hosts script_linux='/my/sweet/script.sh' script_windows='C:\my\sweet\script.ps1'
5353
#
5454
# @example Plan - Basic usage
55-
# run_plan('patching::post_update',
56-
# targets => $all_hosts)
55+
# run_plan('patching::post_update', $all_hosts)
5756
#
5857
# @example Plan - Custom scripts
59-
# run_plan('patching::post_update',
60-
# targets => $all_hosts,
58+
# run_plan('patching::post_update', $all_hosts,
6159
# script_linux => '/my/sweet/script.sh',
6260
# script_windows => 'C:\my\sweet\script.ps1')
6361
#
@@ -67,13 +65,12 @@
6765
String[1] $script_windows = 'C:\ProgramData\patching\bin\post_update.ps1',
6866
Boolean $noop = false,
6967
) {
70-
$_targets = run_plan('patching::get_targets', targets => $targets)
68+
$_targets = run_plan('patching::get_targets', $targets)
7169
$group_vars = $_targets[0].vars
7270
$_script_linux = pick($group_vars['patching_post_update_script_linux'], $script_linux)
7371
$_script_windows = pick($group_vars['patching_post_update_script_windows'], $script_windows)
7472

75-
return run_plan('patching::pre_post_update',
76-
targets => $_targets,
73+
return run_plan('patching::pre_post_update', $_targets,
7774
task => 'patching::post_update',
7875
script_linux => $_script_linux,
7976
script_windows => $_script_windows,

plans/pre_post_update.pp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@
2727
Boolean $noop = false,
2828
) {
2929
out::message("pre_post_update - noop = ${noop}")
30-
$_targets = run_plan('patching::get_targets',
31-
targets => $targets)
30+
$_targets = run_plan('patching::get_targets', $targets)
3231

3332
# split into linux vs Windows
3433
$targets_linux = $_targets.filter |$t| { facts($t)['os']['family'] != 'windows' }

plans/pre_update.pp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,10 @@
5252
# bolt plan run patching::pre_update --targets all_hosts script_linux='/my/sweet/script.sh' script_windows='C:\my\sweet\script.ps1'
5353
#
5454
# @example Plan - Basic usage
55-
# run_plan('patching::pre_update',
56-
# targets => $all_hosts)
55+
# run_plan('patching::pre_update', $all_hosts)
5756
#
5857
# @example Plan - Custom scripts
59-
# run_plan('patching::pre_update',
60-
# targets => $all_hosts,
58+
# run_plan('patching::pre_update', $all_hosts,
6159
# script_linux => '/my/sweet/script.sh',
6260
# script_windows => 'C:\my\sweet\script.ps1')
6361
#
@@ -67,13 +65,12 @@
6765
String[1] $script_windows = 'C:\ProgramData\patching\bin\pre_update.ps1',
6866
Boolean $noop = false,
6967
) {
70-
$_targets = run_plan('patching::get_targets', targets => $targets)
68+
$_targets = run_plan('patching::get_targets', $targets)
7169
$group_vars = $_targets[0].vars
7270
$_script_linux = pick($group_vars['patching_pre_update_script_linux'], $script_linux)
7371
$_script_windows = pick($group_vars['patching_pre_update_script_windows'], $script_windows)
7472

75-
return run_plan('patching::pre_post_update',
76-
targets => $_targets,
73+
return run_plan('patching::pre_post_update', $_targets,
7774
task => 'patching::pre_update',
7875
script_linux => $_script_linux,
7976
script_windows => $_script_windows,

0 commit comments

Comments
 (0)