bolt 3.13.0 → 3.14.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 (40) hide show
  1. checksums.yaml +4 -4
  2. data/Puppetfile +1 -1
  3. data/bolt-modules/boltlib/lib/puppet/functions/background.rb +2 -1
  4. data/bolt-modules/boltlib/lib/puppet/functions/parallelize.rb +5 -1
  5. data/bolt-modules/boltlib/lib/puppet/functions/run_plan.rb +13 -0
  6. data/bolt-modules/boltlib/lib/puppet/functions/wait.rb +47 -7
  7. data/bolt-modules/out/lib/puppet/functions/out/message.rb +4 -2
  8. data/bolt-modules/out/lib/puppet/functions/out/verbose.rb +4 -2
  9. data/lib/bolt/analytics.rb +1 -1
  10. data/lib/bolt/bolt_option_parser.rb +4 -1
  11. data/lib/bolt/cli.rb +21 -6
  12. data/lib/bolt/config/transport/options.rb +12 -0
  13. data/lib/bolt/config/transport/ssh.rb +7 -0
  14. data/lib/bolt/executor.rb +12 -4
  15. data/lib/bolt/fiber_executor.rb +57 -12
  16. data/lib/bolt/outputter/human.rb +117 -12
  17. data/lib/bolt/outputter/json.rb +3 -5
  18. data/lib/bolt/outputter/logger.rb +1 -1
  19. data/lib/bolt/pal.rb +36 -3
  20. data/lib/bolt/pal/yaml_plan/step.rb +2 -0
  21. data/lib/bolt/pal/yaml_plan/step/message.rb +0 -8
  22. data/lib/bolt/pal/yaml_plan/step/verbose.rb +31 -0
  23. data/lib/bolt/plan_future.rb +21 -6
  24. data/lib/bolt/transport/ssh/exec_connection.rb +3 -1
  25. data/lib/bolt/version.rb +1 -1
  26. data/lib/bolt_server/schemas/partials/target-ssh.json +4 -0
  27. data/lib/bolt_server/schemas/partials/target-winrm.json +4 -0
  28. data/lib/bolt_server/transport_app.rb +81 -50
  29. data/lib/bolt_spec/plans/mock_executor.rb +16 -6
  30. metadata +11 -14
  31. data/guides/debugging.txt +0 -28
  32. data/guides/guide.txt +0 -17
  33. data/guides/inventory.txt +0 -24
  34. data/guides/links.txt +0 -13
  35. data/guides/logging.txt +0 -18
  36. data/guides/module.txt +0 -19
  37. data/guides/modulepath.txt +0 -25
  38. data/guides/project.txt +0 -22
  39. data/guides/targets.txt +0 -29
  40. data/guides/transports.txt +0 -23
@@ -39,6 +39,7 @@ module BoltSpec
39
39
  # plans that are allowed to be executed by the @executor_real
40
40
  @allowed_exec_plans = {}
41
41
  @id = 0
42
+ @plan_futures = []
42
43
  end
43
44
 
44
45
  def module_file_id(file)
@@ -280,7 +281,7 @@ module BoltSpec
280
281
  false
281
282
  end
282
283
 
283
- def create_future(scope: nil, name: nil)
284
+ def create_future(plan_id:, scope: nil, name: nil)
284
285
  newscope = nil
285
286
  if scope
286
287
  # Create the new scope
@@ -295,13 +296,18 @@ module BoltSpec
295
296
  # Execute "futures" serially when running in BoltSpec
296
297
  result = yield newscope
297
298
  @id += 1
298
- future = Bolt::PlanFuture.new(nil, @id, name: name)
299
+ future = Bolt::PlanFuture.new(nil, @id, name: name, plan_id: plan_id)
299
300
  future.value = result
301
+ @plan_futures << future
300
302
  future
301
303
  end
302
304
 
303
- def wait(results, **_kwargs)
304
- results
305
+ def get_futures_for_plan(plan_id:)
306
+ @plan_futures.select { |future| future.plan_id == plan_id }
307
+ end
308
+
309
+ def wait(futures, **_kwargs)
310
+ futures.map(&:value)
305
311
  end
306
312
 
307
313
  # Since Futures are executed immediately once created, this will always
@@ -310,8 +316,12 @@ module BoltSpec
310
316
  true
311
317
  end
312
318
 
313
- def plan_futures
314
- []
319
+ def get_current_future(fiber)
320
+ @plan_futures.select { |f| f.fiber == fiber }&.first
321
+ end
322
+
323
+ def get_current_plan_id(fiber)
324
+ get_current_future(fiber)&.current_plan
315
325
  end
316
326
 
317
327
  # Public methods on Bolt::Executor that need to be mocked so there aren't
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bolt
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.13.0
4
+ version: 3.14.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-07-12 00:00:00.000000000 Z
11
+ date: 2021-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -70,16 +70,22 @@ dependencies:
70
70
  name: ffi
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: 1.9.25
73
76
  - - "<"
74
77
  - !ruby/object:Gem::Version
75
- version: 1.14.0
78
+ version: 2.0.0
76
79
  type: :runtime
77
80
  prerelease: false
78
81
  version_requirements: !ruby/object:Gem::Requirement
79
82
  requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: 1.9.25
80
86
  - - "<"
81
87
  - !ruby/object:Gem::Version
82
- version: 1.14.0
88
+ version: 2.0.0
83
89
  - !ruby/object:Gem::Dependency
84
90
  name: hiera-eyaml
85
91
  requirement: !ruby/object:Gem::Requirement
@@ -460,16 +466,6 @@ files:
460
466
  - bolt-modules/prompt/lib/puppet/functions/prompt/menu.rb
461
467
  - bolt-modules/system/lib/puppet/functions/system/env.rb
462
468
  - exe/bolt
463
- - guides/debugging.txt
464
- - guides/guide.txt
465
- - guides/inventory.txt
466
- - guides/links.txt
467
- - guides/logging.txt
468
- - guides/module.txt
469
- - guides/modulepath.txt
470
- - guides/project.txt
471
- - guides/targets.txt
472
- - guides/transports.txt
473
469
  - lib/bolt.rb
474
470
  - lib/bolt/analytics.rb
475
471
  - lib/bolt/applicator.rb
@@ -538,6 +534,7 @@ files:
538
534
  - lib/bolt/pal/yaml_plan/step/script.rb
539
535
  - lib/bolt/pal/yaml_plan/step/task.rb
540
536
  - lib/bolt/pal/yaml_plan/step/upload.rb
537
+ - lib/bolt/pal/yaml_plan/step/verbose.rb
541
538
  - lib/bolt/pal/yaml_plan/transpiler.rb
542
539
  - lib/bolt/plan_creator.rb
543
540
  - lib/bolt/plan_future.rb
data/guides/debugging.txt DELETED
@@ -1,28 +0,0 @@
1
- TOPIC
2
- debugging
3
-
4
- DESCRIPTION
5
- When Bolt isn't behaving as expected, there are a few helpful commands and
6
- logs that can help identify common issues. The first place to look is in
7
- `<PROJECT>/bolt-debug.log`, which contains debug-level logs from the last Bolt
8
- run. This log file includes where the Bolt project was loaded from, the
9
- location of any configuration or inventory files that were loaded, and the
10
- modulepath that modules were loaded from.
11
-
12
- If you're having issues with loading targets or target configuration, you
13
- can see the list of resolved Bolt target names by running `bolt inventory
14
- show` on *nix systems or `Get-BoltInventory` in PowerShell. To see the
15
- resolved configuration for each target, run the command with the `--detail` or
16
- `-Detail` options.
17
-
18
- Lastly, if you're having trouble loading Bolt content you can use `bolt
19
- module show` on *nix systems or `Get-BoltModule` in PowerShell to see the list
20
- of loaded modules, including where they were loaded from. You can also use
21
- `bolt task show` or `Get-BoltTask` to list loaded tasks, and `bolt plan show`
22
- or `Get-BoltPlan` to list loaded plans.
23
-
24
- Visit the linked documentation for more in-depth troubleshooting help for
25
- specific issues.
26
-
27
- DOCUMENTATION
28
- https://pup.pt/bolt-troubleshooting
data/guides/guide.txt DELETED
@@ -1,17 +0,0 @@
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/inventory.txt DELETED
@@ -1,24 +0,0 @@
1
- TOPIC
2
- inventory
3
-
4
- DESCRIPTION
5
- The inventory describes the targets that you run Bolt commands on, along
6
- with any data and configuration for the targets. Targets in an inventory can
7
- belong to one or more groups, allowing you to share data and configuration
8
- across multiple targets and to specify multiple targets for your Bolt
9
- commands without the need to list each target individually.
10
-
11
- In most cases, Bolt loads the inventory from an inventory file in your Bolt
12
- project. The inventory file is a YAML file named 'inventory.yaml'. Because
13
- Bolt loads the inventory file from a Bolt project, you must have an existing
14
- project configuration file named 'bolt-project.yaml' alongside the inventory
15
- file.
16
-
17
- When Bolt loads inventory, it loads the entire inventory, not just the
18
- groups and targets specified on the command line. If you've defined a
19
- target in multiple groups, this might result in target configuration that
20
- is different than expected.
21
-
22
- DOCUMENTATION
23
- https://pup.pt/bolt-inventory
24
- https://pup.pt/bolt-inventory-reference
data/guides/links.txt DELETED
@@ -1,13 +0,0 @@
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
data/guides/logging.txt DELETED
@@ -1,18 +0,0 @@
1
- TOPIC
2
- logging
3
-
4
- DESCRIPTION
5
- Bolt prints messages both to the console and to log files. Messages can
6
- either come from Bolt's 'outputter', which logs user-facing messages like
7
- progress and results, or from the 'logger', which logs warnings, errors, and
8
- log-structured output to log files. Both of these message streams are
9
- configurable.
10
-
11
- By default, Bolt logs to the console at 'warn' level and writes a log file to
12
- '<project>/bolt-debug.log' at 'debug' level. Unless you are running a plan,
13
- Bolt runs in verbose mode by default.
14
-
15
- To learn more about projects, see the 'project' guide.
16
-
17
- DOCUMENTATION
18
- https://pup.pt/bolt-logging
data/guides/module.txt DELETED
@@ -1,19 +0,0 @@
1
- TOPIC
2
- module
3
-
4
- DESCRIPTION
5
- Modules are shareable, reusable packages of Puppet content. They can include
6
- tasks, plans, functions, and other types of content that you can use in your
7
- project. You can download and install modules to your project from the
8
- Puppet Forge or write your own modules. Bolt also ships with several helpful
9
- modules pre-installed that are available to all of your projects.
10
-
11
- Bolt makes it easy to manage the modules that your project depends on. You
12
- can use Bolt commands to install a project's modules, add new modules to a
13
- project, and view the modules that are available to the project.
14
-
15
- To learn more about managing modules in a project, see the documentation.
16
- To learn how modules are loaded by Bolt, see the 'modulepath' guide.
17
-
18
- DOCUMENTATION
19
- https://pup.pt/bolt-modules
@@ -1,25 +0,0 @@
1
- TOPIC
2
- modulepath
3
-
4
- DESCRIPTION
5
- The modulepath is an ordered list of directories that Bolt loads modules
6
- from. When Bolt runs a command, it automatically loads modules from the
7
- modulepath.
8
-
9
- While Bolt has a default modulepath, you can also configure your own
10
- modulepath, which can include directories within the project or directories
11
- elsewhere on your system. Regardless of whether your project uses a default
12
- or configured modulepath, Bolt automatically adds directories to the
13
- modulepath. This includes modules containing core Bolt content, which is
14
- added to the beginning of the modulepath, and bundled content, which is
15
- added to the end of the modulepath.
16
-
17
- Modules loaded from a directory listed earlier in the modulepath take
18
- precedence over modules with the same name loaded from a directory later in
19
- the modulepath. Bolt will not warn or error when two modules share a name
20
- and instead will ignore modules with a lower precedence.
21
-
22
- To learn more about modules, see the 'module' guide.
23
-
24
- DOCUMENTATION
25
- https://pup.pt/bolt-project-reference#modulepath
data/guides/project.txt DELETED
@@ -1,22 +0,0 @@
1
- TOPIC
2
- project
3
-
4
- DESCRIPTION
5
- A Bolt project is a directory that serves as the launching point for Bolt
6
- and allows you to create a shareable orchestration application. Projects
7
- typically include a project configuration file, an inventory file, and any
8
- content you use in your project workflow, such as tasks and plans.
9
-
10
- When you run Bolt, it runs in the context of a project. If the directory you
11
- run Bolt from is not a project, Bolt attempts to find a project by
12
- traversing the parent directories. If Bolt is unable to find a project, it
13
- runs from the default project, located at '~/.puppetlabs/bolt'.
14
-
15
- A directory is only considered a Bolt project when it has a project
16
- configuration file named 'bolt-project.yaml'. Bolt doesn't load project data
17
- and content, including inventory files, unless the data and content are part
18
- of a project.
19
-
20
- DOCUMENTATION
21
- https://pup.pt/bolt-projects
22
- https://pup.pt/bolt-project-reference
data/guides/targets.txt DELETED
@@ -1,29 +0,0 @@
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
@@ -1,23 +0,0 @@
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