bolt 3.4.0 → 3.7.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of bolt might be problematic. Click here for more details.

Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/Puppetfile +2 -2
  3. data/bolt-modules/boltlib/lib/puppet/datatypes/applyresult.rb +26 -0
  4. data/bolt-modules/boltlib/lib/puppet/datatypes/containerresult.rb +51 -0
  5. data/bolt-modules/boltlib/lib/puppet/datatypes/resourceinstance.rb +43 -0
  6. data/bolt-modules/boltlib/lib/puppet/datatypes/result.rb +29 -0
  7. data/bolt-modules/boltlib/lib/puppet/datatypes/resultset.rb +34 -0
  8. data/bolt-modules/boltlib/lib/puppet/datatypes/target.rb +55 -0
  9. data/bolt-modules/boltlib/lib/puppet/functions/add_to_group.rb +1 -0
  10. data/bolt-modules/boltlib/lib/puppet/functions/apply_prep.rb +1 -0
  11. data/bolt-modules/boltlib/lib/puppet/functions/parallelize.rb +1 -0
  12. data/bolt-modules/boltlib/lib/puppet/functions/puppetdb_command.rb +66 -0
  13. data/bolt-modules/boltlib/lib/puppet/functions/remove_from_group.rb +1 -0
  14. data/bolt-modules/boltlib/lib/puppet/functions/run_container.rb +162 -0
  15. data/bolt-modules/boltlib/lib/puppet/functions/write_file.rb +1 -0
  16. data/bolt-modules/boltlib/types/planresult.pp +1 -0
  17. data/bolt-modules/ctrl/lib/puppet/functions/ctrl/do_until.rb +2 -0
  18. data/guides/guide.txt +17 -0
  19. data/guides/links.txt +13 -0
  20. data/guides/targets.txt +29 -0
  21. data/guides/transports.txt +23 -0
  22. data/lib/bolt/analytics.rb +4 -8
  23. data/lib/bolt/bolt_option_parser.rb +329 -225
  24. data/lib/bolt/cli.rb +58 -29
  25. data/lib/bolt/config.rb +11 -7
  26. data/lib/bolt/config/options.rb +41 -9
  27. data/lib/bolt/config/transport/podman.rb +33 -0
  28. data/lib/bolt/container_result.rb +105 -0
  29. data/lib/bolt/error.rb +15 -0
  30. data/lib/bolt/executor.rb +17 -13
  31. data/lib/bolt/inventory.rb +5 -4
  32. data/lib/bolt/inventory/inventory.rb +3 -2
  33. data/lib/bolt/inventory/options.rb +9 -0
  34. data/lib/bolt/inventory/target.rb +16 -0
  35. data/lib/bolt/module_installer/specs/git_spec.rb +10 -6
  36. data/lib/bolt/outputter/human.rb +242 -76
  37. data/lib/bolt/outputter/json.rb +6 -4
  38. data/lib/bolt/outputter/logger.rb +17 -0
  39. data/lib/bolt/pal/yaml_plan/step.rb +4 -2
  40. data/lib/bolt/plan_creator.rb +2 -2
  41. data/lib/bolt/plugin.rb +13 -11
  42. data/lib/bolt/puppetdb/client.rb +54 -0
  43. data/lib/bolt/result.rb +1 -4
  44. data/lib/bolt/shell/bash.rb +23 -10
  45. data/lib/bolt/transport/docker.rb +1 -1
  46. data/lib/bolt/transport/docker/connection.rb +23 -34
  47. data/lib/bolt/transport/podman.rb +19 -0
  48. data/lib/bolt/transport/podman/connection.rb +98 -0
  49. data/lib/bolt/transport/ssh/connection.rb +3 -6
  50. data/lib/bolt/util.rb +34 -0
  51. data/lib/bolt/version.rb +1 -1
  52. data/lib/bolt_server/transport_app.rb +3 -0
  53. data/lib/bolt_spec/plans/mock_executor.rb +91 -11
  54. data/modules/puppet_connect/plans/test_input_data.pp +22 -0
  55. metadata +13 -2
@@ -9,6 +9,7 @@ Puppet::Functions.create_function(:write_file) do
9
9
  # @param content File content to write.
10
10
  # @param destination An absolute path on the target(s).
11
11
  # @param targets A pattern identifying zero or more targets. See {get_targets} for accepted patterns.
12
+ # @param options A hash of additional options.
12
13
  # @option options [Boolean] _catch_errors Whether to catch raised errors.
13
14
  # @option options [String] _run_as User to run as using privilege escalation.
14
15
  # @return A list of results, one entry per target.
@@ -12,5 +12,6 @@ type Boltlib::PlanResult = Variant[Boolean,
12
12
  ResultSet,
13
13
  Target,
14
14
  ResourceInstance,
15
+ ContainerResult,
15
16
  Array[Boltlib::PlanResult],
16
17
  Hash[String, Boltlib::PlanResult]]
@@ -3,8 +3,10 @@
3
3
  # Repeat the block until it returns a truthy value. Returns the value.
4
4
  Puppet::Functions.create_function(:'ctrl::do_until') do
5
5
  # @param options A hash of additional options.
6
+ # @param block The code block to repeat.
6
7
  # @option options [Numeric] limit The number of times to repeat the block.
7
8
  # @option options [Numeric] interval The number of seconds to wait before repeating the block.
9
+ # @return [nil]
8
10
  # @example Run a task until it succeeds
9
11
  # ctrl::do_until() || {
10
12
  # run_task('test', $target, '_catch_errors' => true).ok()
data/guides/guide.txt ADDED
@@ -0,0 +1,17 @@
1
+ TOPIC
2
+ guide
3
+
4
+ DESCRIPTION
5
+ A guide is a person (or CLI tool ;D) who leads travelers through unknown or
6
+ unfamiliar locations. The term can also be applied to a person who leads others
7
+ to more abstract goals such as knowledge or wisdom.
8
+
9
+ Etymology: Originated sometime between 1325 and 1375. From Middle English
10
+ guide, from the Old French guide, from Old Occitan guida, from guidar, from
11
+ Frankish *wītan (“to show the way, lead”), from Proto-Germanic *wītaną (“to
12
+ see, know; go, depart”), from Proto-Indo-European *weyd- (“to see, know”).
13
+ Related also to English wit.
14
+
15
+ DOCUMENTATION
16
+ https://en.wikipedia.org/wiki/Guide
17
+ https://en.wiktionary.org/wiki/guide
data/guides/links.txt ADDED
@@ -0,0 +1,13 @@
1
+ TOPIC
2
+ links
3
+
4
+ DESCRIPTION
5
+ Bolt documentation https://bolt.guide
6
+ Ask a question in #bolt https://slack.puppet.com/
7
+ Contribute at https://github.com/puppetlabs/bolt/
8
+ Getting Started Guide https://pup.pt/bolt-getting-started
9
+ Reference Documentation https://pup.pt/bolt-reference
10
+ Troubleshooting Bolt https://pup.pt/bolt-troubleshooting
11
+ Bolt Developer Updates https://pup.pt/bolt-dev-updates
12
+ Bolt Changelog https://pup.pt/bolt-changelog
13
+ Bolt Examples https://pup.pt/bolt-examples
@@ -0,0 +1,29 @@
1
+ TOPIC
2
+ targets
3
+
4
+ DESCRIPTION
5
+ A target is a device that Bolt connects to and runs actions on. Targets can
6
+ be physical, such as servers, or virtual, such as containers or virtual
7
+ machines.
8
+
9
+ Several of Bolt's commands connect to targets and run actions on them.
10
+ These commands require a target or targets to run on. You can specify
11
+ targets to a command using one of the following command-line options:
12
+
13
+ *nix options Powershell options
14
+ -t, --targets TARGETS -T, -Targets TARGETS
15
+ -q, --query QUERY -Q, -Query QUERY
16
+ --rerun FILTER -Rerun FILTER
17
+
18
+ The 'targets' option accepts a comma-separated list of target URIs or group
19
+ names, or can read a target list from an input file '@<file>' or stdin '-'.
20
+ URIs can be specified with the format [protocol://][user@]host[:port]. To
21
+ learn more about available protocols and their defaults, run 'bolt guide
22
+ transports'.
23
+
24
+ Typically, targets and their configuration and data are listed in a
25
+ project's inventory file. For more information about inventory files,
26
+ see 'bolt guide inventory'.
27
+
28
+ DOCUMENTATION
29
+ https://pup.pt/bolt-commands
@@ -0,0 +1,23 @@
1
+ TOPIC
2
+ transports
3
+
4
+ DESCRIPTION
5
+ Bolt uses transports (also known as protocols) to establish a connection
6
+ with a target in order to run actions on the target. The default transport is
7
+ SSH, and you can see available transports along with their configuration
8
+ options and defaults at http://pup.pt/bolt-reference.
9
+
10
+ You can specify a transport for a target by prepending '<transport>://' to
11
+ the target's URI. For example, to connect to a target with hostname
12
+ 'example.com' as user 'Administrator' using the WinRM transport, you would
13
+ pass the following to the target flag:
14
+ winrm://Administrator@example.com
15
+
16
+ You can also specify a default transport for all targets by passing the
17
+ '--transport' flag on *nix systems and the '-Transport' flag in Powershell.
18
+ Finally, you can set the transport for a target in the inventory. For more
19
+ information about the Bolt inventory, run 'bolt guide inventory'.
20
+
21
+ DOCUMENTATION
22
+ https://pup.pt/bolt-commands#specify-a-transport
23
+ http://pup.pt/bolt-inventory#transport-configuration
@@ -29,7 +29,7 @@ module Bolt
29
29
  yaml_plan_count: :cd13
30
30
  }.freeze
31
31
 
32
- def self.build_client
32
+ def self.build_client(enabled = true)
33
33
  logger = Bolt::Logger.logger(self)
34
34
  begin
35
35
  config_file = config_path
@@ -38,7 +38,7 @@ module Bolt
38
38
  config = { 'disabled' => true }
39
39
  end
40
40
 
41
- if config['disabled'] || ENV['BOLT_DISABLE_ANALYTICS']
41
+ if !enabled || config['disabled'] || ENV['BOLT_DISABLE_ANALYTICS']
42
42
  logger.debug "Analytics opt-out is set, analytics will be disabled"
43
43
  NoopClient.new
44
44
  else
@@ -80,12 +80,8 @@ module Bolt
80
80
  unless ENV['BOLT_DISABLE_ANALYTICS']
81
81
  msg = <<~ANALYTICS
82
82
  Bolt collects data about how you use it. You can opt out of providing this data.
83
-
84
- To disable analytics data collection, add this line to ~/.puppetlabs/etc/bolt/analytics.yaml :
85
- disabled: true
86
-
87
- Read more about what data Bolt collects and why here:
88
- https://puppet.com/docs/bolt/latest/bolt_installing.html#analytics-data-collection
83
+ To learn how to disable data collection, or see what data Bolt collects and why,
84
+ see http://pup.pt/bolt-analytics
89
85
  ANALYTICS
90
86
  Bolt::Logger.warn_once('analytics_opt_out', msg)
91
87
  end
@@ -156,18 +156,30 @@ module Bolt
156
156
  end
157
157
  end
158
158
 
159
+ COLORS = {
160
+ cyan: "36"
161
+ }.freeze
162
+
163
+ def self.colorize(color, string)
164
+ if $stdout.isatty
165
+ "\033[#{COLORS[color]}m#{string}\033[0m"
166
+ else
167
+ string
168
+ end
169
+ end
170
+
159
171
  BANNER = <<~HELP
160
- NAME
172
+ #{colorize(:cyan, 'Name')}
161
173
  bolt
162
174
 
163
- USAGE
175
+ #{colorize(:cyan, 'Usage')}
164
176
  bolt <subcommand> [action] [options]
165
177
 
166
- DESCRIPTION
178
+ #{colorize(:cyan, 'Description')}
167
179
  Bolt is an orchestration tool that automates the manual work it takes to
168
180
  maintain your infrastructure.
169
181
 
170
- SUBCOMMANDS
182
+ #{colorize(:cyan, 'Subcommands')}
171
183
  apply Apply Puppet manifest code
172
184
  command Run a command remotely
173
185
  file Copy files between the controller and targets
@@ -181,76 +193,92 @@ module Bolt
181
193
  secret Create encryption keys and encrypt and decrypt values
182
194
  task Show and run Bolt tasks
183
195
 
184
- GUIDES
196
+ #{colorize(:cyan, 'Guides')}
185
197
  For a list of guides on Bolt's concepts and features, run 'bolt guide'.
198
+ Find Bolt's documentation at https://bolt.guide.
186
199
  HELP
187
200
 
188
201
  APPLY_HELP = <<~HELP
189
- NAME
202
+ #{colorize(:cyan, 'Name')}
190
203
  apply
191
204
 
192
- USAGE
193
- bolt apply [manifest.pp] [options]
205
+ #{colorize(:cyan, 'Usage')}
206
+ bolt apply [manifest] {--targets TARGETS | --query QUERY | --rerun FILTER}
207
+ [options]
194
208
 
195
- DESCRIPTION
209
+ #{colorize(:cyan, 'Description')}
196
210
  Apply Puppet manifest code on the specified targets.
197
211
 
198
- EXAMPLES
212
+ #{colorize(:cyan, 'Documentation')}
213
+ For documentation see http://pup.pt/bolt-apply.
214
+
215
+ #{colorize(:cyan, 'Examples')}
199
216
  bolt apply manifest.pp -t target
200
217
  bolt apply -e "file { '/etc/puppetlabs': ensure => present }" -t target
201
218
  HELP
202
219
 
203
220
  COMMAND_HELP = <<~HELP
204
- NAME
221
+ #{colorize(:cyan, 'Name')}
205
222
  command
206
223
 
207
- USAGE
224
+ #{colorize(:cyan, 'Usage')}
208
225
  bolt command <action> [options]
209
226
 
210
- DESCRIPTION
227
+ #{colorize(:cyan, 'Description')}
211
228
  Run a command on the specified targets.
212
229
 
213
- ACTIONS
230
+ #{colorize(:cyan, 'Documentation')}
231
+ For documentation see http://pup.pt/bolt-commands.
232
+
233
+ #{colorize(:cyan, 'Actions')}
214
234
  run Run a command on the specified targets.
215
235
  HELP
216
236
 
217
237
  COMMAND_RUN_HELP = <<~HELP
218
- NAME
238
+ #{colorize(:cyan, 'Name')}
219
239
  run
220
240
 
221
- USAGE
222
- bolt command run <command> [options]
241
+ #{colorize(:cyan, 'Usage')}
242
+ bolt command run <command> {--targets TARGETS | --query QUERY | --rerun FILTER}
243
+ [options]
223
244
 
224
- DESCRIPTION
245
+ #{colorize(:cyan, 'Description')}
225
246
  Run a command on the specified targets.
226
247
 
227
- EXAMPLES
248
+ #{colorize(:cyan, 'Documentation')}
249
+ For documentation see http://pup.pt/bolt-commands.
250
+
251
+ #{colorize(:cyan, 'Examples')}
228
252
  bolt command run 'uptime' -t target1,target2
229
253
  HELP
230
254
 
231
255
  FILE_HELP = <<~HELP
232
- NAME
256
+ #{colorize(:cyan, 'Name')}
233
257
  file
234
258
 
235
- USAGE
259
+ #{colorize(:cyan, 'Usage')}
236
260
  bolt file <action> [options]
237
261
 
238
- DESCRIPTION
239
- Copy files and directories between the controller and targets
262
+ #{colorize(:cyan, 'Description')}
263
+ Copy files and directories between the controller and targets.
264
+
265
+ #{colorize(:cyan, 'Documentation')}
266
+ For documentation see http://pup.pt/bolt-commands.
240
267
 
241
- ACTIONS
268
+ #{colorize(:cyan, 'Actions')}
242
269
  download Download a file or directory to the controller
243
270
  upload Upload a local file or directory from the controller
244
271
  HELP
245
272
 
246
273
  FILE_DOWNLOAD_HELP = <<~HELP
247
- NAME
274
+ #{colorize(:cyan, 'Name')}
248
275
  download
249
276
 
250
- USAGE
251
- bolt file download <src> <dest> [options]
277
+ #{colorize(:cyan, 'Usage')}
278
+ bolt file download <source> <destination> {--targets TARGETS | --query QUERY | --rerun FILTER}
279
+ [options]
252
280
 
253
- DESCRIPTION
281
+ #{colorize(:cyan, 'Description')}
254
282
  Download a file or directory from one or more targets.
255
283
 
256
284
  Downloaded files and directories are saved to the a subdirectory
@@ -258,63 +286,76 @@ module Bolt
258
286
  destination directory is expanded relative to the downloads
259
287
  subdirectory of the project directory.
260
288
 
261
- EXAMPLES
289
+ #{colorize(:cyan, 'Documentation')}
290
+ For documentation see http://pup.pt/bolt-commands.
291
+
292
+ #{colorize(:cyan, 'Examples')}
262
293
  bolt file download /etc/ssh_config ssh_config -t all
263
294
  HELP
264
295
 
265
296
  FILE_UPLOAD_HELP = <<~HELP
266
- NAME
297
+ #{colorize(:cyan, 'Name')}
267
298
  upload
268
299
 
269
- USAGE
270
- bolt file upload <src> <dest> [options]
300
+ #{colorize(:cyan, 'Usage')}
301
+ bolt file upload <source> <destination> {--targets TARGETS | --query QUERY | --rerun FILTER}
302
+ [options]
271
303
 
272
- DESCRIPTION
304
+ #{colorize(:cyan, 'Description')}
273
305
  Upload a local file or directory.
274
306
 
275
- EXAMPLES
307
+ #{colorize(:cyan, 'Documentation')}
308
+ For documentation see http://pup.pt/bolt-commands.
309
+
310
+ #{colorize(:cyan, 'Examples')}
276
311
  bolt file upload /tmp/source /etc/profile.d/login.sh -t target1
277
312
  HELP
278
313
 
279
314
  GROUP_HELP = <<~HELP
280
- NAME
315
+ #{colorize(:cyan, 'Name')}
281
316
  group
282
317
 
283
- USAGE
318
+ #{colorize(:cyan, 'Usage')}
284
319
  bolt group <action> [options]
285
320
 
286
- DESCRIPTION
321
+ #{colorize(:cyan, 'Description')}
287
322
  Show the list of groups in the inventory.
288
323
 
289
- ACTIONS
324
+ #{colorize(:cyan, 'Documentation')}
325
+ To learn more about the inventory run 'bolt guide inventory'.
326
+
327
+ #{colorize(:cyan, 'Actions')}
290
328
  show Show the list of groups in the inventory
291
329
  HELP
292
330
 
293
331
  GROUP_SHOW_HELP = <<~HELP
294
- NAME
332
+ #{colorize(:cyan, 'Name')}
295
333
  show
296
334
 
297
- USAGE
335
+ #{colorize(:cyan, 'Usage')}
298
336
  bolt group show [options]
299
337
 
300
- DESCRIPTION
338
+ #{colorize(:cyan, 'Description')}
301
339
  Show the list of groups in the inventory.
340
+
341
+ #{colorize(:cyan, 'Documentation')}
342
+ To learn more about the inventory run 'bolt guide inventory'.
302
343
  HELP
303
344
 
304
345
  GUIDE_HELP = <<~HELP
305
- NAME
346
+ #{colorize(:cyan, 'Name')}
306
347
  guide
307
348
 
308
- USAGE
349
+ #{colorize(:cyan, 'Usage')}
309
350
  bolt guide [topic] [options]
310
351
 
311
- DESCRIPTION
352
+ #{colorize(:cyan, 'Description')}
312
353
  View guides for Bolt's concepts and features.
313
354
 
314
355
  Omitting a topic will display a list of available guides,
315
356
  while providing a topic will display the relevant guide.
316
357
 
317
- EXAMPLES
358
+ #{colorize(:cyan, 'Examples')}
318
359
  View a list of available guides
319
360
  bolt guide
320
361
  View the 'project' guide page
@@ -322,44 +363,55 @@ module Bolt
322
363
  HELP
323
364
 
324
365
  INVENTORY_HELP = <<~HELP
325
- NAME
366
+ #{colorize(:cyan, 'Name')}
326
367
  inventory
327
368
 
328
- USAGE
369
+ #{colorize(:cyan, 'Usage')}
329
370
  bolt inventory <action> [options]
330
371
 
331
- DESCRIPTION
372
+ #{colorize(:cyan, 'Description')}
332
373
  Show the list of targets an action would run on.
333
374
 
334
- ACTIONS
375
+ #{colorize(:cyan, 'Documentation')}
376
+ To learn more about the inventory run 'bolt guide inventory'.
377
+
378
+ #{colorize(:cyan, 'Actions')}
335
379
  show Show the list of targets an action would run on
336
380
  HELP
337
381
 
338
382
  INVENTORY_SHOW_HELP = <<~HELP
339
- NAME
383
+ #{colorize(:cyan, 'Name')}
340
384
  show
341
385
 
342
- USAGE
386
+ #{colorize(:cyan, 'Usage')}
343
387
  bolt inventory show [options]
344
388
 
345
- DESCRIPTION
346
- Show the list of targets an action would run on.
389
+ #{colorize(:cyan, 'Description')}
390
+ Show the list of targets an action would run on. This command will list
391
+ all targets in the project's inventory by default.
392
+
393
+ To filter the targets in the list, use the --targets, --query, or --rerun
394
+ options. To view detailed configuration and data for targets, use the
395
+ --detail option. To learn more about the inventory run 'bolt guide inventory'.
396
+
397
+ #{colorize(:cyan, 'Documentation')}
398
+ To learn more about the inventory run 'bolt guide inventory'.
347
399
  HELP
348
400
 
349
401
  MODULE_HELP = <<~HELP
350
- NAME
402
+ #{colorize(:cyan, 'Name')}
351
403
  module
352
404
 
353
- USAGE
405
+ #{colorize(:cyan, 'Usage')}
354
406
  bolt module <action> [options]
355
407
 
356
- DESCRIPTION
357
- Manage Bolt project modules
408
+ #{colorize(:cyan, 'Description')}
409
+ Manage Bolt project modules.
358
410
 
359
- The module command is only supported when a project is configured
360
- with the 'modules' key.
411
+ #{colorize(:cyan, 'Documentation')}
412
+ To learn more about Bolt modules run 'bolt guide module'.
361
413
 
362
- ACTIONS
414
+ #{colorize(:cyan, 'Actions')}
363
415
  add Add a module to the project
364
416
  generate-types Generate type references to register in plans
365
417
  install Install the project's modules
@@ -367,77 +419,84 @@ module Bolt
367
419
  HELP
368
420
 
369
421
  MODULE_ADD_HELP = <<~HELP
370
- NAME
422
+ #{colorize(:cyan, 'Name')}
371
423
  add
372
424
 
373
- USAGE
425
+ #{colorize(:cyan, 'Usage')}
374
426
  bolt module add <module> [options]
375
427
 
376
- DESCRIPTION
428
+ #{colorize(:cyan, 'Description')}
377
429
  Add a module to the project.
378
430
 
379
431
  Module declarations are loaded from the project's configuration
380
432
  file. Bolt will automatically resolve all module dependencies,
381
433
  generate a Puppetfile, and install the modules.
382
434
 
383
- The module command is only supported when a project is configured
384
- with the 'modules' key.
435
+ #{colorize(:cyan, 'Documentation')}
436
+ To learn more about Bolt modules, run 'bolt guide module'.
385
437
  HELP
386
438
 
387
439
  MODULE_GENERATETYPES_HELP = <<~HELP
388
- NAME
440
+ #{colorize(:cyan, 'Name')}
389
441
  generate-types
390
442
 
391
- USAGE
443
+ #{colorize(:cyan, 'Usage')}
392
444
  bolt module generate-types [options]
393
445
 
394
- DESCRIPTION
395
- Generate type references to register in plans.
446
+ #{colorize(:cyan, 'Description')}
447
+ Generate type references to register in plans. To learn more about
448
+ Bolt modules, run 'bolt guide module'.
396
449
 
397
- The module command is only supported when a project is configured
398
- with the 'modules' key.
450
+ #{colorize(:cyan, 'Documentation')}
451
+ To learn more about Bolt modules, run 'bolt guide module'.
399
452
  HELP
400
453
 
401
454
  MODULE_INSTALL_HELP = <<~HELP
402
- NAME
455
+ #{colorize(:cyan, 'Name')}
403
456
  install
404
457
 
405
- USAGE
458
+ #{colorize(:cyan, 'Usage')}
406
459
  bolt module install [options]
407
460
 
408
- DESCRIPTION
461
+ #{colorize(:cyan, 'Description')}
409
462
  Install the project's modules.
410
463
 
411
464
  Module declarations are loaded from the project's configuration
412
465
  file. Bolt will automatically resolve all module dependencies,
413
466
  generate a Puppetfile, and install the modules.
467
+
468
+ #{colorize(:cyan, 'Documentation')}
469
+ To learn more about Bolt modules, run 'bolt guide module'.
414
470
  HELP
415
471
 
416
472
  MODULE_SHOW_HELP = <<~HELP
417
- NAME
473
+ #{colorize(:cyan, 'Name')}
418
474
  show
419
475
 
420
- USAGE
476
+ #{colorize(:cyan, 'Usage')}
421
477
  bolt module show [options]
422
478
 
423
- DESCRIPTION
479
+ #{colorize(:cyan, 'Description')}
424
480
  List modules available to the Bolt project.
425
481
 
426
- The module command is only supported when a project is configured
427
- with the 'modules' key.
482
+ #{colorize(:cyan, 'Documentation')}
483
+ To learn more about Bolt modules, run 'bolt guide module'.
428
484
  HELP
429
485
 
430
486
  PLAN_HELP = <<~HELP
431
- NAME
487
+ #{colorize(:cyan, 'Name')}
432
488
  plan
433
489
 
434
- USAGE
435
- bolt plan <action> [parameters] [options]
490
+ #{colorize(:cyan, 'Usage')}
491
+ bolt plan <action> [options]
436
492
 
437
- DESCRIPTION
493
+ #{colorize(:cyan, 'Description')}
438
494
  Convert, create, show, and run Bolt plans.
439
495
 
440
- ACTIONS
496
+ #{colorize(:cyan, 'Documentation')}
497
+ Learn more about Bolt plans at https://pup.pt/bolt-plans.
498
+
499
+ #{colorize(:cyan, 'Actions')}
441
500
  convert Convert a YAML plan to a Bolt plan
442
501
  new Create a new plan in the current project
443
502
  run Run a plan on the specified targets
@@ -445,59 +504,70 @@ module Bolt
445
504
  HELP
446
505
 
447
506
  PLAN_CONVERT_HELP = <<~HELP
448
- NAME
507
+ #{colorize(:cyan, 'Name')}
449
508
  convert
450
509
 
451
- USAGE
452
- bolt plan convert <path> [options]
510
+ #{colorize(:cyan, 'Usage')}
511
+ bolt plan convert <plan name> [options]
453
512
 
454
- DESCRIPTION
455
- Convert a YAML plan to a Puppet language plan and print the converted plan to stdout.
513
+ #{colorize(:cyan, 'Description')}
514
+ Convert a YAML plan to a Puppet language plan and print the converted
515
+ plan to stdout.
456
516
 
457
517
  Converting a YAML plan might result in a plan that is syntactically
458
518
  correct but has different behavior. Always verify a converted plan's
459
519
  functionality. Note that the converted plan is not written to a file.
460
520
 
461
- EXAMPLES
521
+ #{colorize(:cyan, 'Documentation')}
522
+ Learn more about Bolt plans at https://pup.pt/bolt-plans.
523
+
524
+ #{colorize(:cyan, 'Examples')}
525
+ bolt plan convert myproject::myplan
462
526
  bolt plan convert path/to/plan/myplan.yaml
463
527
  HELP
464
528
 
465
529
  PLAN_NEW_HELP = <<~HELP
466
- NAME
530
+ #{colorize(:cyan, 'Name')}
467
531
  new
468
532
 
469
- USAGE
470
- bolt plan new <plan> [options]
533
+ #{colorize(:cyan, 'Usage')}
534
+ bolt plan new <plan name> [options]
471
535
 
472
- DESCRIPTION
536
+ #{colorize(:cyan, 'Description')}
473
537
  Create a new plan in the current project.
474
538
 
475
- EXAMPLES
539
+ #{colorize(:cyan, 'Documentation')}
540
+ Learn more about Bolt plans at https://pup.pt/bolt-plans.
541
+
542
+ #{colorize(:cyan, 'Examples')}
476
543
  bolt plan new myproject::myplan
477
544
  HELP
478
545
 
479
546
  PLAN_RUN_HELP = <<~HELP
480
- NAME
547
+ #{colorize(:cyan, 'Name')}
481
548
  run
482
549
 
483
- USAGE
484
- bolt plan run <plan> [parameters] [options]
550
+ #{colorize(:cyan, 'Usage')}
551
+ bolt plan run <plan name> [parameters] [options]
485
552
 
486
- DESCRIPTION
553
+ #{colorize(:cyan, 'Description')}
487
554
  Run a plan on the specified targets.
488
555
 
489
- EXAMPLES
556
+ #{colorize(:cyan, 'Documentation')}
557
+ Learn more about Bolt plans at https://pup.pt/bolt-plans.
558
+
559
+ #{colorize(:cyan, 'Examples')}
490
560
  bolt plan run canary --targets target1,target2 command=hostname
491
561
  HELP
492
562
 
493
563
  PLAN_SHOW_HELP = <<~HELP
494
- NAME
564
+ #{colorize(:cyan, 'Name')}
495
565
  show
496
566
 
497
- USAGE
498
- bolt plan show [plan] [options]
567
+ #{colorize(:cyan, 'Usage')}
568
+ bolt plan show [plan name] [options]
499
569
 
500
- DESCRIPTION
570
+ #{colorize(:cyan, 'Description')}
501
571
  Show available plans and plan documentation.
502
572
 
503
573
  Omitting the name of a plan will display a list of plans available
@@ -506,7 +576,10 @@ module Bolt
506
576
  Providing the name of a plan will display detailed documentation for
507
577
  the plan, including a list of available parameters.
508
578
 
509
- EXAMPLES
579
+ #{colorize(:cyan, 'Documentation')}
580
+ Learn more about Bolt plans at https://pup.pt/bolt-plans.
581
+
582
+ #{colorize(:cyan, 'Examples')}
510
583
  Display a list of available plans
511
584
  bolt plan show
512
585
  Display documentation for the aggregate::count plan
@@ -514,33 +587,39 @@ module Bolt
514
587
  HELP
515
588
 
516
589
  PROJECT_HELP = <<~HELP
517
- NAME
590
+ #{colorize(:cyan, 'Name')}
518
591
  project
519
592
 
520
- USAGE
593
+ #{colorize(:cyan, 'Usage')}
521
594
  bolt project <action> [options]
522
595
 
523
- DESCRIPTION
596
+ #{colorize(:cyan, 'Description')}
524
597
  Create and migrate Bolt projects
525
598
 
526
- ACTIONS
599
+ #{colorize(:cyan, 'Documentation')}
600
+ To learn more about Bolt projects, run 'bolt guide project'.
601
+
602
+ #{colorize(:cyan, 'Actions')}
527
603
  init Create a new Bolt project
528
604
  migrate Migrate a Bolt project to the latest version
529
605
  HELP
530
606
 
531
607
  PROJECT_INIT_HELP = <<~HELP
532
- NAME
608
+ #{colorize(:cyan, 'Name')}
533
609
  init
534
610
 
535
- USAGE
611
+ #{colorize(:cyan, 'Usage')}
536
612
  bolt project init [name] [options]
537
613
 
538
- DESCRIPTION
614
+ #{colorize(:cyan, 'Description')}
539
615
  Create a new Bolt project in the current working directory.
540
616
 
541
617
  Specify a name for the Bolt project. Defaults to the basename of the current working directory.
542
618
 
543
- EXAMPLES
619
+ #{colorize(:cyan, 'Documentation')}
620
+ To learn more about Bolt projects, run 'bolt guide project'.
621
+
622
+ #{colorize(:cyan, 'Examples')}
544
623
  Create a new Bolt project using the directory as the project name.
545
624
  bolt project init
546
625
  Create a new Bolt project with a specified name.
@@ -550,136 +629,166 @@ module Bolt
550
629
  HELP
551
630
 
552
631
  PROJECT_MIGRATE_HELP = <<~HELP
553
- NAME
632
+ #{colorize(:cyan, 'Name')}
554
633
  migrate
555
634
 
556
- USAGE
635
+ #{colorize(:cyan, 'Usage')}
557
636
  bolt project migrate [options]
558
637
 
559
- DESCRIPTION
560
- Migrate a Bolt project to use current best practices and the latest version of configuration files.
638
+ #{colorize(:cyan, 'Description')}
639
+ Migrate a Bolt project to use current best practices and the latest version of
640
+ configuration files.
641
+
642
+ #{colorize(:cyan, 'Documentation')}
643
+ To learn more about Bolt projects, run 'bolt guide project'.
561
644
  HELP
562
645
 
563
646
  SCRIPT_HELP = <<~HELP
564
- NAME
647
+ #{colorize(:cyan, 'Name')}
565
648
  script
566
649
 
567
- USAGE
650
+ #{colorize(:cyan, 'Usage')}
568
651
  bolt script <action> [options]
569
652
 
570
- DESCRIPTION
653
+ #{colorize(:cyan, 'Description')}
571
654
  Run a script on the specified targets.
572
655
 
573
- ACTIONS
656
+ #{colorize(:cyan, 'Documentation')}
657
+ Learn more about running scrips at https://pup.pt/bolt-commands.
658
+
659
+ #{colorize(:cyan, 'Actions')}
574
660
  run Run a script on the specified targets.
575
661
  HELP
576
662
 
577
663
  SCRIPT_RUN_HELP = <<~HELP
578
- NAME
664
+ #{colorize(:cyan, 'Name')}
579
665
  run
580
666
 
581
- USAGE
582
- bolt script run <script> [arguments] [options]
667
+ #{colorize(:cyan, 'Usage')}
668
+ bolt script run <script> [arguments] {--targets TARGETS | --query QUERY | --rerun FILTER}
669
+ [options]
583
670
 
584
- DESCRIPTION
671
+ #{colorize(:cyan, 'Description')}
585
672
  Run a script on the specified targets.
586
673
 
587
674
  Arguments passed to a script are passed literally and are not interpolated
588
675
  by the shell. Any arguments containing spaces or special characters should
589
676
  be quoted.
590
677
 
591
- EXAMPLES
678
+ #{colorize(:cyan, 'Documentation')}
679
+ Learn more about running scrips at https://pup.pt/bolt-commands.
680
+
681
+ #{colorize(:cyan, 'Examples')}
592
682
  bolt script run myscript.sh 'echo hello' --targets target1,target2
593
683
  HELP
594
684
 
595
685
  SECRET_HELP = <<~HELP
596
- NAME
686
+ #{colorize(:cyan, 'Name')}
597
687
  secret
598
688
 
599
- USAGE
689
+ #{colorize(:cyan, 'Usage')}
600
690
  bolt secret <action> [options]
601
691
 
602
- DESCRIPTION
692
+ #{colorize(:cyan, 'Description')}
603
693
  Create encryption keys and encrypt and decrypt values.
604
694
 
605
- ACTIONS
695
+ #{colorize(:cyan, 'Documentation')}
696
+ Learn more about secrets plugins at http://pup.pt/bolt-plugins.
697
+
698
+ #{colorize(:cyan, 'Actions')}
606
699
  createkeys Create new encryption keys
607
700
  encrypt Encrypt a value
608
701
  decrypt Decrypt a value
609
702
  HELP
610
703
 
611
704
  SECRET_CREATEKEYS_HELP = <<~HELP
612
- NAME
705
+ #{colorize(:cyan, 'Name')}
613
706
  createkeys
614
707
 
615
- USAGE
708
+ #{colorize(:cyan, 'Usage')}
616
709
  bolt secret createkeys [options]
617
710
 
618
- DESCRIPTION
711
+ #{colorize(:cyan, 'Description')}
619
712
  Create new encryption keys.
713
+
714
+ #{colorize(:cyan, 'Documentation')}
715
+ Learn more about secrets plugins at http://pup.pt/bolt-plugins.
620
716
  HELP
621
717
 
622
718
  SECRET_DECRYPT_HELP = <<~HELP
623
- NAME
719
+ #{colorize(:cyan, 'Name')}
624
720
  decrypt
625
721
 
626
- USAGE
722
+ #{colorize(:cyan, 'Usage')}
627
723
  bolt secret decrypt <ciphertext> [options]
628
724
 
629
- DESCRIPTION
725
+ #{colorize(:cyan, 'Description')}
630
726
  Decrypt a value.
727
+
728
+ #{colorize(:cyan, 'Documentation')}
729
+ Learn more about secrets plugins at http://pup.pt/bolt-plugins.
631
730
  HELP
632
731
 
633
732
  SECRET_ENCRYPT_HELP = <<~HELP
634
- NAME
733
+ #{colorize(:cyan, 'Name')}
635
734
  encrypt
636
735
 
637
- USAGE
736
+ #{colorize(:cyan, 'Usage')}
638
737
  bolt secret encrypt <plaintext> [options]
639
738
 
640
- DESCRIPTION
739
+ #{colorize(:cyan, 'Description')}
641
740
  Encrypt a value.
741
+
742
+ #{colorize(:cyan, 'Documentation')}
743
+ Learn more about secrets plugins at http://pup.pt/bolt-plugins.
642
744
  HELP
643
745
 
644
746
  TASK_HELP = <<~HELP
645
- NAME
747
+ #{colorize(:cyan, 'Name')}
646
748
  task
647
749
 
648
- USAGE
750
+ #{colorize(:cyan, 'Usage')}
649
751
  bolt task <action> [options]
650
752
 
651
- DESCRIPTION
753
+ #{colorize(:cyan, 'Description')}
652
754
  Show and run Bolt tasks.
653
755
 
654
- ACTIONS
756
+ #{colorize(:cyan, 'Documentation')}
757
+ Learn more about Bolt tasks at http://pup.pt/bolt-tasks.
758
+
759
+ #{colorize(:cyan, 'Actions')}
655
760
  run Run a Bolt task
656
761
  show Show available tasks and task documentation
657
762
  HELP
658
763
 
659
764
  TASK_RUN_HELP = <<~HELP
660
- NAME
765
+ #{colorize(:cyan, 'Name')}
661
766
  run
662
767
 
663
- USAGE
664
- bolt task run <task> [parameters] [options]
768
+ #{colorize(:cyan, 'Usage')}
769
+ bolt task run <task name> [parameters] {--targets TARGETS | --query QUERY | --rerun FILTER}
770
+ [options]
665
771
 
666
- DESCRIPTION
772
+ #{colorize(:cyan, 'Description')}
667
773
  Run a task on the specified targets.
668
774
 
669
775
  Parameters take the form parameter=value.
670
776
 
671
- EXAMPLES
777
+ #{colorize(:cyan, 'Documentation')}
778
+ Learn more about Bolt tasks at http://pup.pt/bolt-tasks.
779
+
780
+ #{colorize(:cyan, 'Examples')}
672
781
  bolt task run package --targets target1,target2 action=status name=bash
673
782
  HELP
674
783
 
675
784
  TASK_SHOW_HELP = <<~HELP
676
- NAME
785
+ #{colorize(:cyan, 'Name')}
677
786
  show
678
787
 
679
- USAGE
680
- bolt task show [task] [options]
788
+ #{colorize(:cyan, 'Usage')}
789
+ bolt task show [task name] [options]
681
790
 
682
- DESCRIPTION
791
+ #{colorize(:cyan, 'Description')}
683
792
  Show available tasks and task documentation.
684
793
 
685
794
  Omitting the name of a task will display a list of tasks available
@@ -688,7 +797,10 @@ module Bolt
688
797
  Providing the name of a task will display detailed documentation for
689
798
  the task, including a list of available parameters.
690
799
 
691
- EXAMPLES
800
+ #{colorize(:cyan, 'Documentation')}
801
+ Learn more about Bolt tasks at http://pup.pt/bolt-tasks.
802
+
803
+ #{colorize(:cyan, 'Examples')}
692
804
  Display a list of available tasks
693
805
  bolt task show
694
806
  Display documentation for the canary task
@@ -700,119 +812,108 @@ module Bolt
700
812
 
701
813
  @options = options
702
814
 
703
- separator "\nINVENTORY OPTIONS"
704
- define('-t', '--targets TARGETS',
705
- 'Identifies the targets of command.',
706
- 'Enter a comma-separated list of target URIs or group names.',
707
- "Or read a target list from an input file '@<file>' or stdin '-'.",
708
- 'Example: --targets localhost,target_group,ssh://nix.com:23,winrm://windows.puppet.com',
709
- 'URI format is [protocol://]host[:port]',
710
- "SSH is the default protocol; can be #{TRANSPORTS.keys.join(', ')}",
711
- 'For Windows targets, specify the winrm:// protocol if it has not be configured',
712
- 'For SSH, port defaults to `22`',
713
- 'For WinRM, port defaults to `5985` or `5986` based on the --[no-]ssl setting') do |targets|
815
+ separator "\n#{self.class.colorize(:cyan, 'Inventory options')}"
816
+ define('-t', '--targets TARGETS', 'Identifies the targets of the command.',
817
+ "For more information, see 'bolt guide targets'.") do |targets|
714
818
  @options[:targets] ||= []
715
819
  @options[:targets] << Bolt::Util.get_arg_input(targets)
716
820
  end
717
- define('-q', '--query QUERY', 'Query PuppetDB to determine the targets') do |query|
821
+ define('-q', '--query QUERY', 'Query PuppetDB to determine the targets.') do |query|
718
822
  @options[:query] = query
719
823
  end
720
- define('--rerun FILTER', 'Retry on targets from the last run',
721
- "'all' all targets that were part of the last run.",
722
- "'failure' targets that failed in the last run.",
723
- "'success' targets that succeeded in the last run.") do |rerun|
824
+ define("--rerun FILTER", "Retry on targets from the last run.",
825
+ "Available filters are 'all', 'failure', and 'success'.") do |rerun|
724
826
  @options[:rerun] = rerun
725
827
  end
726
- define('--noop', 'See what changes Bolt will make without actually executing the changes') do |_|
828
+ define('--noop', 'See what changes Bolt will make without actually executing the changes.') do |_|
727
829
  @options[:noop] = true
728
830
  end
729
831
  define('--params PARAMETERS',
730
- "Parameters to a task or plan as json, a json file '@<file>', or on stdin '-'") do |params|
832
+ "Parameters to a task or plan as json, a json file '@<file>', or on stdin '-'.") do |params|
731
833
  @options[:task_options] = parse_params(params)
732
834
  end
733
835
  define('-e', '--execute CODE',
734
- "Puppet manifest code to apply to the targets") do |code|
836
+ "Puppet manifest code to apply to the targets.") do |code|
735
837
  @options[:code] = code
736
838
  end
737
- define('--detail', 'Show resolved configuration for the targets') do |detail|
839
+ define('--detail', 'Show resolved configuration for the targets.') do |detail|
738
840
  @options[:detail] = detail
739
841
  end
740
842
 
741
- separator "\nAUTHENTICATION OPTIONS"
742
- define('-u', '--user USER', 'User to authenticate as') do |user|
843
+ separator "\n#{self.class.colorize(:cyan, 'Authentication options')}"
844
+ define('-u', '--user USER', 'User to authenticate as.') do |user|
743
845
  @options[:user] = user
744
846
  end
745
847
  define('-p', '--password PASSWORD',
746
- 'Password to authenticate with') do |password|
848
+ 'Password to authenticate with.') do |password|
747
849
  @options[:password] = password
748
850
  end
749
- define('--password-prompt', 'Prompt for user to input password') do |_password|
851
+ define('--password-prompt', 'Prompt for user to input password.') do |_password|
750
852
  $stderr.print "Please enter your password: "
751
853
  @options[:password] = $stdin.noecho(&:gets).chomp
752
854
  $stderr.puts
753
855
  end
754
- define('--private-key KEY', 'Path to private ssh key to authenticate with') do |key|
856
+ define('--private-key KEY', 'Path to private ssh key to authenticate with.') do |key|
755
857
  @options[:'private-key'] = File.expand_path(key)
756
858
  end
757
- define('--[no-]host-key-check', 'Check host keys with SSH') do |host_key_check|
859
+ define('--[no-]host-key-check', 'Check host keys with SSH.') do |host_key_check|
758
860
  @options[:'host-key-check'] = host_key_check
759
861
  end
760
- define('--[no-]ssl', 'Use SSL with WinRM') do |ssl|
862
+ define('--[no-]ssl', 'Use SSL with WinRM.') do |ssl|
761
863
  @options[:ssl] = ssl
762
864
  end
763
- define('--[no-]ssl-verify', 'Verify remote host SSL certificate with WinRM') do |ssl_verify|
865
+ define('--[no-]ssl-verify', 'Verify remote host SSL certificate with WinRM.') do |ssl_verify|
764
866
  @options[:'ssl-verify'] = ssl_verify
765
867
  end
766
868
 
767
- separator "\nESCALATION OPTIONS"
768
- define('--run-as USER', 'User to run as using privilege escalation') do |user|
869
+ separator "\n#{self.class.colorize(:cyan, 'Escalation options')}"
870
+ define('--run-as USER', 'User to run as using privilege escalation.') do |user|
769
871
  @options[:'run-as'] = user
770
872
  end
771
873
  define('--sudo-password PASSWORD',
772
- 'Password for privilege escalation') do |password|
874
+ 'Password for privilege escalation.') do |password|
773
875
  @options[:'sudo-password'] = password
774
876
  end
775
- define('--sudo-password-prompt', 'Prompt for user to input escalation password') do |_password|
877
+ define('--sudo-password-prompt', 'Prompt for user to input escalation password.') do |_password|
776
878
  $stderr.print "Please enter your privilege escalation password: "
777
879
  @options[:'sudo-password'] = $stdin.noecho(&:gets).chomp
778
880
  $stderr.puts
779
881
  end
780
- define('--sudo-executable EXEC', "Specify an executable for running as another user.",
781
- "This option is experimental.") do |exec|
882
+ define('--sudo-executable EXEC', "Experimental. Specify an executable for running as another user.") do |exec|
782
883
  @options[:'sudo-executable'] = exec
783
884
  end
784
885
 
785
- separator "\nRUN CONTEXT OPTIONS"
886
+ separator "\n#{self.class.colorize(:cyan, 'Run context options')}"
786
887
  define('-c', '--concurrency CONCURRENCY', Integer,
787
- 'Maximum number of simultaneous connections') do |concurrency|
888
+ 'Maximum number of simultaneous connections.') do |concurrency|
788
889
  @options[:concurrency] = concurrency
789
890
  end
790
891
  define('--compile-concurrency CONCURRENCY', Integer,
791
- 'Maximum number of simultaneous manifest block compiles (default: number of cores)') do |concurrency|
892
+ 'Maximum number of simultaneous manifest block compiles (default: number of cores).') do |concurrency|
792
893
  @options[:'compile-concurrency'] = concurrency
793
894
  end
794
895
  define('--[no-]cleanup',
795
- 'Whether to clean up temporary files created on targets') do |cleanup|
896
+ 'Whether to clean up temporary files created on targets.') do |cleanup|
796
897
  @options[:cleanup] = cleanup
797
898
  end
798
899
  define('-m', '--modulepath MODULES',
799
900
  "List of directories containing modules, separated by '#{File::PATH_SEPARATOR}'",
800
- 'Directories are case-sensitive') do |modulepath|
901
+ 'Directories are case-sensitive.') do |modulepath|
801
902
  # When specified from the CLI, modulepath entries are relative to pwd
802
903
  @options[:modulepath] = modulepath.split(File::PATH_SEPARATOR).map do |moduledir|
803
904
  File.expand_path(moduledir)
804
905
  end
805
906
  end
806
907
  define('--project PATH',
807
- 'Path to load the Bolt project from (default: autodiscovered from current dir)') do |path|
908
+ 'Path to load the Bolt project from (default: autodiscovered from current dir).') do |path|
808
909
  @options[:project] = path
809
910
  end
810
911
  define('--hiera-config PATH',
811
- 'Specify where to load Hiera config from (default: ~/.puppetlabs/bolt/hiera.yaml)') do |path|
912
+ 'Specify where to load Hiera config from (default: <project>/hiera.yaml).') do |path|
812
913
  @options[:'hiera-config'] = File.expand_path(path)
813
914
  end
814
915
  define('-i', '--inventoryfile PATH',
815
- 'Specify where to load inventory from (default: ~/.puppetlabs/bolt/inventory.yaml)') do |path|
916
+ 'Specify where to load inventory from (default: <project>/inventory.yaml).') do |path|
816
917
  if ENV.include?(Bolt::Inventory::ENVIRONMENT_VAR)
817
918
  raise Bolt::CLIError, "Cannot pass inventory file when #{Bolt::Inventory::ENVIRONMENT_VAR} is set"
818
919
  end
@@ -822,8 +923,8 @@ module Bolt
822
923
  @options[:'save-rerun'] = save
823
924
  end
824
925
 
825
- separator "\nREMOTE ENVIRONMENT OPTIONS"
826
- define('--env-var ENVIRONMENT_VARIABLES', 'Environment variables to set on the target') do |envvar|
926
+ separator "\n#{self.class.colorize(:cyan, 'Remote environment options')}"
927
+ define('--env-var ENVIRONMENT_VARIABLES', 'Environment variables to set on the target.') do |envvar|
827
928
  unless envvar.include?('=')
828
929
  raise Bolt::CLIError, "Environment variables must be specified using 'myenvvar=key' format"
829
930
  end
@@ -831,47 +932,47 @@ module Bolt
831
932
  @options[:env_vars].store(*envvar.split('=', 2))
832
933
  end
833
934
 
834
- separator "\nTRANSPORT OPTIONS"
935
+ separator "\n#{self.class.colorize(:cyan, 'Transport options')}"
835
936
  define('--transport TRANSPORT', TRANSPORTS.keys.map(&:to_s),
836
- "Specify a default transport: #{TRANSPORTS.keys.join(', ')}") do |t|
937
+ "Specify a default transport: #{TRANSPORTS.keys.join(', ')}.",
938
+ "For more information, see 'bolt guide transports'.") do |t|
837
939
  @options[:transport] = t
838
940
  end
839
- define('--[no-]native-ssh', 'Whether to shell out to native SSH or use the net-ssh Ruby library.',
840
- 'This option is experimental') do |bool|
941
+ define('--[no-]native-ssh',
942
+ 'Experimental. Whether to shell out to native SSH or use the net-ssh Ruby library.') do |bool|
841
943
  @options[:'native-ssh'] = bool
842
944
  end
843
- define('--ssh-command EXEC', "Executable to use instead of the net-ssh Ruby library. ",
844
- "This option is experimental.") do |exec|
945
+ define('--ssh-command EXEC', "Experimental. Executable to use instead of the net-ssh Ruby library.") do |exec|
845
946
  @options[:'ssh-command'] = exec
846
947
  end
847
- define('--copy-command EXEC', "Command to copy files to remote hosts if using native SSH. ",
848
- "This option is experimental.") do |exec|
948
+ define('--copy-command EXEC',
949
+ "Experimental. Command to copy files to remote hosts if using native SSH.") do |exec|
849
950
  @options[:'copy-command'] = exec
850
951
  end
851
- define('--connect-timeout TIMEOUT', Integer, 'Connection timeout in seconds (defaults vary)') do |timeout|
952
+ define('--connect-timeout TIMEOUT', Integer, 'Connection timeout in seconds (defaults vary).') do |timeout|
852
953
  @options[:'connect-timeout'] = timeout
853
954
  end
854
- define('--[no-]tty', 'Request a pseudo TTY on targets that support it') do |tty|
955
+ define('--[no-]tty', 'Request a pseudo TTY on targets that support it.') do |tty|
855
956
  @options[:tty] = tty
856
957
  end
857
- define('--tmpdir DIR', 'The directory to upload and execute temporary files on the target') do |tmpdir|
958
+ define('--tmpdir DIR', 'The directory to upload and execute temporary files on the target.') do |tmpdir|
858
959
  @options[:tmpdir] = tmpdir
859
960
  end
860
961
 
861
- separator "\nMODULE OPTIONS"
962
+ separator "\n#{self.class.colorize(:cyan, 'Module options')}"
862
963
  define('--[no-]resolve',
863
964
  'Use --no-resolve to install modules listed in the Puppetfile without resolving modules configured',
864
- 'in Bolt project configuration') do |resolve|
965
+ 'in Bolt project configuration.') do |resolve|
865
966
  @options[:resolve] = resolve
866
967
  end
867
968
 
868
- separator "\nPLAN OPTIONS"
969
+ separator "\n#{self.class.colorize(:cyan, 'Plan options')}"
869
970
  define('--pp', 'Create a new Puppet language plan.') do |_|
870
971
  @options[:puppet] = true
871
972
  end
872
973
 
873
- separator "\nDISPLAY OPTIONS"
874
- define('--filter FILTER', 'Filter tasks and plans by a matching substring') do |filter|
974
+ separator "\n#{self.class.colorize(:cyan, 'Display options')}"
975
+ define('--filter FILTER', 'Filter tasks and plans by a matching substring.') do |filter|
875
976
  unless /^[a-z0-9_:]+$/.match(filter)
876
977
  msg = "Illegal characters in filter string '#{filter}'. Filters must match a legal "\
877
978
  "task or plan name."
@@ -879,37 +980,40 @@ module Bolt
879
980
  end
880
981
  @options[:filter] = filter
881
982
  end
882
- define('--format FORMAT', 'Output format to use: human or json') do |format|
983
+ define('--format FORMAT', 'Output format to use: human, json, or rainbow.') do |format|
883
984
  @options[:format] = format
884
985
  end
885
- define('--[no-]color', 'Whether to show output in color') do |color|
986
+ define('--[no-]color', 'Whether to show output in color.') do |color|
886
987
  @options[:color] = color
887
988
  end
888
- define('-v', '--[no-]verbose', 'Display verbose logging') do |value|
989
+ define('-v', '--[no-]verbose', 'Display verbose logging.') do |value|
889
990
  @options[:verbose] = value
890
991
  end
891
- define('--stream', 'Stream output from scripts and commands to the console') do |_|
992
+ define('--stream',
993
+ 'Stream output from scripts and commands to the console.',
994
+ 'Run with --no-verbose to prevent Bolt from displaying output',
995
+ 'a second time after the action is completed.') do |_|
892
996
  @options[:stream] = true
893
997
  end
894
- define('--trace', 'Display error stack traces') do |_|
998
+ define('--trace', 'Display error stack traces.') do |_|
895
999
  @options[:trace] = true
896
1000
  end
897
1001
 
898
- separator "\nADDITIONAL OPTIONS"
1002
+ separator "\n#{self.class.colorize(:cyan, 'Additional options')}"
899
1003
  define('--modules MODULES',
900
1004
  'A comma-separated list of modules to install from the Puppet Forge',
901
1005
  'when initializing a project. Resolves and installs all dependencies.') do |modules|
902
1006
  @options[:modules] = modules.split(',').map { |mod| { 'name' => mod } }
903
1007
  end
904
- define('--force', 'Force a destructive action') do |_force|
1008
+ define('--force', 'Force a destructive action.') do |_force|
905
1009
  @options[:force] = true
906
1010
  end
907
1011
 
908
- separator "\nGLOBAL OPTIONS"
909
- define('-h', '--help', 'Display help') do |_|
1012
+ separator "\n#{self.class.colorize(:cyan, 'Global options')}"
1013
+ define('-h', '--help', 'Display help.') do |_|
910
1014
  @options[:help] = true
911
1015
  end
912
- define('--version', 'Display the version') do |_|
1016
+ define('--version', 'Display the version.') do |_|
913
1017
  puts Bolt::VERSION
914
1018
  raise Bolt::CLIExit
915
1019
  end
@@ -919,10 +1023,10 @@ module Bolt
919
1023
  @options[:log] = { 'console' => { 'level' => level } }
920
1024
  end
921
1025
  define('--clear-cache',
922
- "Clear plugin cache before executing") do |_|
1026
+ "Clear plugin cache before executing.") do |_|
923
1027
  @options[:clear_cache] = true
924
1028
  end
925
- define('--plugin PLUGIN', 'Select the plugin to use') do |plug|
1029
+ define('--plugin PLUGIN', 'Select the plugin to use.') do |plug|
926
1030
  @options[:plugin] = plug
927
1031
  end
928
1032
  end