bolt 3.5.0 → 3.8.0

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