openbolt 9.0.0.pre.rc1 → 9.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/Puppetfile +5 -5
  3. data/bolt-modules/boltlib/lib/puppet/datatypes/result.rb +1 -1
  4. data/bolt-modules/boltlib/lib/puppet/datatypes/resultset.rb +2 -2
  5. data/bolt-modules/boltlib/lib/puppet/datatypes/target.rb +2 -2
  6. data/bolt-modules/boltlib/lib/puppet/functions/apply_prep.rb +2 -2
  7. data/bolt-modules/boltlib/lib/puppet/functions/background.rb +1 -1
  8. data/bolt-modules/boltlib/lib/puppet/functions/fail_plan.rb +1 -1
  9. data/bolt-modules/boltlib/lib/puppet/functions/get_resources.rb +1 -1
  10. data/bolt-modules/boltlib/lib/puppet/functions/puppetdb_command.rb +1 -1
  11. data/bolt-modules/boltlib/lib/puppet/functions/puppetdb_query.rb +1 -1
  12. data/bolt-modules/boltlib/lib/puppet/functions/run_plan.rb +27 -4
  13. data/bolt-modules/boltlib/lib/puppet/functions/wait.rb +2 -2
  14. data/bolt-modules/file/lib/puppet/functions/file/delete.rb +1 -1
  15. data/bolt-modules/file/lib/puppet/functions/file/exists.rb +1 -1
  16. data/bolt-modules/file/lib/puppet/functions/file/read.rb +1 -1
  17. data/bolt-modules/file/lib/puppet/functions/file/readable.rb +1 -1
  18. data/bolt-modules/file/lib/puppet/functions/file/write.rb +1 -1
  19. data/bolt-modules/log/lib/puppet/functions/log/debug.rb +1 -1
  20. data/bolt-modules/log/lib/puppet/functions/log/error.rb +1 -1
  21. data/bolt-modules/log/lib/puppet/functions/log/fatal.rb +1 -1
  22. data/bolt-modules/log/lib/puppet/functions/log/info.rb +1 -1
  23. data/bolt-modules/log/lib/puppet/functions/log/trace.rb +1 -1
  24. data/bolt-modules/log/lib/puppet/functions/log/warn.rb +1 -1
  25. data/guides/targets.yaml +2 -0
  26. data/lib/bolt/bolt_option_parser.rb +53 -53
  27. data/lib/bolt/cli.rb +21 -2
  28. data/lib/bolt/config/options.rb +18 -18
  29. data/lib/bolt/config/transport/choria.rb +3 -0
  30. data/lib/bolt/config/transport/options.rb +34 -11
  31. data/lib/bolt/executor.rb +4 -0
  32. data/lib/bolt/fiber_executor.rb +46 -2
  33. data/lib/bolt/inventory/options.rb +1 -1
  34. data/lib/bolt/plan_future.rb +5 -1
  35. data/lib/bolt/shell/bash.rb +5 -3
  36. data/lib/bolt/shell/powershell/snippets.rb +20 -1
  37. data/lib/bolt/shell/powershell.rb +2 -2
  38. data/lib/bolt/transport/base.rb +9 -4
  39. data/lib/bolt/transport/choria/agent_discovery.rb +32 -14
  40. data/lib/bolt/transport/choria/bolt_tasks.rb +64 -40
  41. data/lib/bolt/transport/choria/client.rb +66 -49
  42. data/lib/bolt/transport/choria/command_builders.rb +144 -24
  43. data/lib/bolt/transport/choria/file_transfer.rb +134 -0
  44. data/lib/bolt/transport/choria/helpers.rb +25 -20
  45. data/lib/bolt/transport/choria/shell.rb +255 -148
  46. data/lib/bolt/transport/choria.rb +96 -27
  47. data/lib/bolt/util.rb +13 -0
  48. data/lib/bolt/version.rb +1 -1
  49. data/lib/bolt_spec/plans/mock_executor.rb +4 -0
  50. data/libexec/apply_catalog.rb +3 -0
  51. metadata +5 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1330d8e29efdcb5a955256f23e7b21341702b971d91e993004754c87573254cd
4
- data.tar.gz: 3e5e5ee382f7e3df85b83c16c63ea43c5f9d35c54f25f2ef50e2589b0591e93d
3
+ metadata.gz: ccffb09806ff6f277b75360ff8f804592795a3712ef3150e525e947673604737
4
+ data.tar.gz: 42fcccda83424540f1ebee736234a00570d4060e560f05ba06864385364c39ad
5
5
  SHA512:
6
- metadata.gz: f957aaf93f718c2626339bb1353d9770da0d2a6b7f16b5628ee63c124df8a45e27add34e72489a98cfb0b12d0b1414f270d1ff42669a499ce777a22a28d46d04
7
- data.tar.gz: 630c9835d6cc18a6b3dd89e2cc3ace763ba22d63bbd06ff8845126ce624bc9c422672c21b30ac17c7f973713c7ba17cecffbaae9ac178ffea3470acb1df8f6cc
6
+ metadata.gz: e6af1fa2f0a8aeb236df11db580692c04b425c9fca04af1321636c488e3f46af603e47fee4ce604c721d0f5ff80cb2acaf076d1fd91a0ac54a76836c29981ee3
7
+ data.tar.gz: a76d500e92acd698776fe5b61d4be4bfe7dd5e6860025b4d0aeba2702e81dea893ec48362968908b52878e092c0c6edf25d0133b81c8d940c7e25bda81136570
data/Puppetfile CHANGED
@@ -6,13 +6,13 @@ moduledir File.join(File.dirname(__FILE__), 'modules')
6
6
 
7
7
  # Core modules used by 'apply'
8
8
  mod 'puppetlabs-service', '4.0.0'
9
- mod 'puppet-openvox_bootstrap', '1.5.0'
9
+ mod 'puppet-openvox_bootstrap', '1.8.0'
10
10
  mod 'puppetlabs-facts', '1.8.1'
11
11
 
12
12
  # Other core Puppet modules
13
- mod 'puppetlabs-inifile', '6.5.0'
14
- mod 'puppetlabs-apt', '11.4.0'
15
- mod 'puppetlabs-stdlib', '10.1.0'
13
+ mod 'puppetlabs-inifile', '6.6.0'
14
+ mod 'puppetlabs-apt', '11.4.1'
15
+ mod 'puppetlabs-stdlib', '10.1.1'
16
16
  mod 'puppetlabs-powershell', '6.2.0'
17
17
  mod 'puppetlabs-pwshlib', '2.1.1'
18
18
 
@@ -31,7 +31,7 @@ mod 'puppetlabs-zone_core', '2.1.0'
31
31
  # Useful additional modules
32
32
  mod 'puppetlabs-package', '4.0.0'
33
33
  mod 'puppetlabs-puppet_conf', '3.0.0'
34
- mod 'puppetlabs-reboot', '6.0.0'
34
+ mod 'puppetlabs-reboot', '6.1.0'
35
35
 
36
36
  # Task helpers
37
37
  mod 'puppetlabs-powershell_task_helper', '0.2.0'
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # For each target that you execute an action on, Bolt returns a `Result` object
3
+ # For each target that you execute an action on, OpenBolt returns a `Result` object
4
4
  # and adds the `Result` to a `ResultSet` object. A `Result` object contains
5
5
  # information about the action you executed on the target.
6
6
  #
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # For each target that you execute an action on, Bolt returns a `Result` object
3
+ # For each target that you execute an action on, OpenBolt returns a `Result` object
4
4
  # and adds the `Result` to a `ResultSet` object. In the case of [apply
5
- # actions](applying_manifest_blocks.md), Bolt returns a `ResultSet` with one or
5
+ # actions](applying_manifest_blocks.md), OpenBolt returns a `ResultSet` with one or
6
6
  # more `ApplyResult` objects.
7
7
  #
8
8
  # @param results
@@ -6,7 +6,7 @@
6
6
  # The inventory configuration for the target. This function returns the
7
7
  # configuration set directly on the target in `inventory.yaml` or set in
8
8
  # a plan using `Target.new` or `set_config()`. It does not return default
9
- # configuration values or configuration set in Bolt configuration files.
9
+ # configuration values or configuration set in OpenBolt configuration files.
10
10
  # @param facts
11
11
  # The target's facts. This function does not look up facts for a target and
12
12
  # only returns the facts specified in an `inventory.yaml` file or set on a
@@ -49,7 +49,7 @@
49
49
  # The transport used to connect to the target.
50
50
  # @!method transport_config
51
51
  # The merged configuration for the target's `transport`. This function returns
52
- # configuration that includes defaults set by Bolt, configuration set in
52
+ # configuration that includes defaults set by OpenBolt, configuration set in
53
53
  # `inventory.yaml`, configuration set in `bolt-defaults.yaml`, and configuration
54
54
  # set in a plan using `set_config()`.
55
55
  # @!method user
@@ -4,13 +4,13 @@ require 'bolt/logger'
4
4
  require 'bolt/task'
5
5
 
6
6
  # Installs the `openvox-agent` package on targets if needed, then collects facts,
7
- # including any custom facts found in Bolt's module path. The package is
7
+ # including any custom facts found in OpenBolt's module path. The package is
8
8
  # installed using either the configured plugin or the `task` plugin with the
9
9
  # `openvox_bootstrap::install` task.
10
10
  #
11
11
  # Agent installation will be skipped if the target includes the `puppet-agent`
12
12
  # feature, either as a property of its transport or by explicitly setting
13
- # it as a feature in Bolt's inventory.
13
+ # it as a feature in OpenBolt's inventory.
14
14
  #
15
15
  # > **Note:** Not available in apply block
16
16
  Puppet::Functions.create_function(:apply_prep) do
@@ -9,7 +9,7 @@ Puppet::Functions.create_function(:background, Puppet::Functions::InternalFuncti
9
9
  # Returns a Future object.
10
10
  # @param name An optional name for legible logs.
11
11
  # @param block The code block to run in the background.
12
- # @return A Bolt Future object
12
+ # @return A Future object
13
13
  # @example Start a long-running process
14
14
  # background() || {
15
15
  # run_task('superlong::task', $targets)
@@ -5,7 +5,7 @@ require 'bolt/error'
5
5
  # Raises a `Bolt::PlanFailure` exception to signal to callers that the plan failed.
6
6
  #
7
7
  # Plan authors should call this function when their plan is not successful. The
8
- # error may then be caught by another plans `run_plan` function or in Bolt itself
8
+ # error may then be caught by another plans `run_plan` function or in OpenBolt itself
9
9
  #
10
10
  # > **Note:** Not available in apply block
11
11
  Puppet::Functions.create_function(:fail_plan) do
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'bolt/task'
4
4
 
5
- # Query the state of resources on a list of targets using resource definitions in Bolt's module path.
5
+ # Query the state of resources on a list of targets using resource definitions in OpenBolt's module path.
6
6
  # The results are returned as a list of hashes representing each resource.
7
7
  #
8
8
  # Requires the Puppet Agent be installed on the target, which can be accomplished with apply_prep
@@ -6,7 +6,7 @@ require 'bolt/error'
6
6
  #
7
7
  # The `pdb_command` function only supports version 5 of the `replace_facts`
8
8
  # command. Other commands might also work, but are not tested or supported
9
- # by Bolt.
9
+ # by OpenBolt.
10
10
  #
11
11
  # See the [commands endpoint](https://puppet.com/docs/puppetdb/latest/api/command/v1/commands.html)
12
12
  # documentation for more information about available commands and payload
@@ -3,7 +3,7 @@
3
3
  require 'bolt/error'
4
4
 
5
5
  # Makes a query to [puppetdb](https://puppet.com/docs/puppetdb/latest/index.html)
6
- # using Bolt's PuppetDB client.
6
+ # using OpenBolt's PuppetDB client.
7
7
  Puppet::Functions.create_function(:puppetdb_query) do
8
8
  # Make a query to PuppetDB.
9
9
  #
@@ -12,7 +12,7 @@ Puppet::Functions.create_function(:run_plan, Puppet::Functions::InternalFunction
12
12
  # @option args [Boolean] _catch_errors Whether to catch raised errors.
13
13
  # @option args [String] _run_as User to run as using privilege escalation.
14
14
  # This option sets the [run-as user](privilege_escalation.md) for all
15
- # targets whenever Bolt connects to a target. This is set for all functions
15
+ # targets whenever OpenBolt connects to a target. This is set for all functions
16
16
  # in the called plan, including `run_plan()`.
17
17
  # @return [PlanResult] The result of running the plan. Undef if plan does not explicitly return results.
18
18
  # @example Run a plan
@@ -35,7 +35,7 @@ Puppet::Functions.create_function(:run_plan, Puppet::Functions::InternalFunction
35
35
  # @option args [Boolean] _catch_errors Whether to catch raised errors.
36
36
  # @option args [String] _run_as User to run as using privilege escalation.
37
37
  # This option sets the [run-as user](privilege_escalation.md) for all
38
- # targets whenever Bolt connects to a target. This is set for all functions
38
+ # targets whenever OpenBolt connects to a target. This is set for all functions
39
39
  # in the called plan, including `run_plan()`.
40
40
  # @return [PlanResult] The result of running the plan. Undef if plan does not explicitly return results.
41
41
  # @example Run a plan
@@ -49,11 +49,34 @@ Puppet::Functions.create_function(:run_plan, Puppet::Functions::InternalFunction
49
49
  end
50
50
 
51
51
  def run_plan_with_targetspec(scope, plan_name, targets, args = {})
52
- run_inner_plan(scope, plan_name, targets, args)
52
+ run_in_new_fiber { run_inner_plan(scope, plan_name, targets, args) }
53
53
  end
54
54
 
55
55
  def run_plan(scope, plan_name, args = {})
56
- run_inner_plan(scope, plan_name, nil, args)
56
+ run_in_new_fiber { run_inner_plan(scope, plan_name, nil, args) }
57
+ end
58
+
59
+ # Load and run each plan on a new Fiber, so plans that run plans don't pile
60
+ # their frames onto one Fiber's small stack.
61
+ def run_in_new_fiber
62
+ # The tasks setting is off in catalog compiles, which have no executor,
63
+ # so run the block inline and let run_inner_plan raise its usual error.
64
+ return yield unless Puppet[:tasks]
65
+
66
+ # A next() in a plan's parameter defaults jumps to the run_plan() call
67
+ # that started the plan, which a new Fiber can't reach. Catch it on the
68
+ # new Fiber and throw it again on this one.
69
+ finished = false
70
+ value = Puppet.lookup(:bolt_executor).run_in_new_fiber do
71
+ catch(:next) do
72
+ result = yield
73
+ finished = true
74
+ result
75
+ end
76
+ end
77
+ return value if finished
78
+
79
+ throw :next, value
57
80
  end
58
81
 
59
82
  def run_inner_plan(scope, plan_name, targets, args = {})
@@ -8,7 +8,7 @@ require 'bolt/logger'
8
8
  # > **Note:** Not available in apply block
9
9
  Puppet::Functions.create_function(:wait, Puppet::Functions::InternalFunction) do
10
10
  # Wait for Futures to finish.
11
- # @param futures A Bolt Future object or array of Bolt Futures to wait on.
11
+ # @param futures A Future object or array of Futures to wait on.
12
12
  # @param options A hash of additional options.
13
13
  # @option options [Boolean] _catch_errors Whether to catch raised errors.
14
14
  # @return A Result or Results from the Futures
@@ -57,7 +57,7 @@ Puppet::Functions.create_function(:wait, Puppet::Functions::InternalFunction) do
57
57
  end
58
58
 
59
59
  # Wait for Futures to finish with timeout.
60
- # @param futures A Bolt Future object or array of Bolt Futures to wait on.
60
+ # @param futures A Future object or array of Futures to wait on.
61
61
  # @param timeout How long to wait for Futures to finish before raising a Timeout error.
62
62
  # @param options A hash of additional options.
63
63
  # @option options [Boolean] _catch_errors Whether to catch raised errors.
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Delete a file on localhost using ruby's `File.delete`. This will only delete
4
- # files on the machine you run Bolt on.
4
+ # files on the machine you run OpenBolt on.
5
5
  Puppet::Functions.create_function(:'file::delete') do
6
6
  # @param filename Absolute path.
7
7
  # @example Delete a file from disk
@@ -2,7 +2,7 @@
2
2
 
3
3
  # Check if a local file exists using Puppet's
4
4
  # `Puppet::Parser::Files.find_file()` function. This will only check files that
5
- # are on the machine Bolt is run on.
5
+ # are on the machine OpenBolt is run on.
6
6
  Puppet::Functions.create_function(:'file::exists', Puppet::Functions::InternalFunction) do
7
7
  # @param filename Absolute path or Puppet file path.
8
8
  # @return Whether the file exists.
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Read a file on localhost and return its contents using ruby's `File.read`. This will
4
- # only read files on the machine you run Bolt on.
4
+ # only read files on the machine you run OpenBolt on.
5
5
  Puppet::Functions.create_function(:'file::read', Puppet::Functions::InternalFunction) do
6
6
  # @param filename Absolute path or Puppet file path.
7
7
  # @return The file's contents.
@@ -2,7 +2,7 @@
2
2
 
3
3
  # Check if a local file is readable using Puppet's
4
4
  # `Puppet::Parser::Files.find_file()` function. This will only check files on the
5
- # machine you run Bolt on.
5
+ # machine you run OpenBolt on.
6
6
  Puppet::Functions.create_function(:'file::readable', Puppet::Functions::InternalFunction) do
7
7
  # @param filename Absolute path or Puppet file path.
8
8
  # @return Whether the file is readable.
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Write a string to a file on localhost using ruby's `File.write`. This will
4
- # only write files to the machine you run Bolt on. Use `write_file()` to write
4
+ # only write files to the machine you run OpenBolt on. Use `write_file()` to write
5
5
  # to remote targets.
6
6
  Puppet::Functions.create_function(:'file::write') do
7
7
  # @param filename Absolute path.
@@ -8,7 +8,7 @@ require 'bolt/util/format'
8
8
  # what a plan is doing. For example, you might log a message at the `debug`
9
9
  # level that shows what value is returned from a function invocation.
10
10
  #
11
- # See [Logs](logs.md) for more information about Bolt's log levels.
11
+ # See [Logs](logs.md) for more information about OpenBolt's log levels.
12
12
  #
13
13
  # > **Note:** Not available in apply block
14
14
  Puppet::Functions.create_function(:'log::debug') do
@@ -9,7 +9,7 @@ require 'bolt/util/format'
9
9
  # `error` level if you want to inform the user an action running on a target
10
10
  # failed but that the plan will continue running.
11
11
  #
12
- # See [Logs](logs.md) for more information about Bolt's log levels.
12
+ # See [Logs](logs.md) for more information about OpenBolt's log levels.
13
13
  #
14
14
  # > **Note:** Not available in apply block
15
15
  Puppet::Functions.create_function(:'log::error') do
@@ -9,7 +9,7 @@ require 'bolt/util/format'
9
9
  # `fatal` level if a service is unavailable and the plan cannot continue running
10
10
  # without it.
11
11
  #
12
- # See [Logs](logs.md) for more information about Bolt's log levels.
12
+ # See [Logs](logs.md) for more information about OpenBolt's log levels.
13
13
  #
14
14
  # > **Note:** Not available in apply block
15
15
  Puppet::Functions.create_function(:'log::fatal') do
@@ -8,7 +8,7 @@ require 'bolt/util/format'
8
8
  # what a plan is doing. For example, you might log a message at the `info` level
9
9
  # that informs users that the plan is reading a file on disk.
10
10
  #
11
- # See [Logs](logs.md) for more information about Bolt's log levels.
11
+ # See [Logs](logs.md) for more information about OpenBolt's log levels.
12
12
  #
13
13
  # > **Note:** Not available in apply block
14
14
  Puppet::Functions.create_function(:'log::info') do
@@ -8,7 +8,7 @@ require 'bolt/util/format'
8
8
  # about what a plan is doing. For example, you might log a message at the `trace`
9
9
  # level that describes how a plan is manipulating data.
10
10
  #
11
- # See [Logs](logs.md) for more information about Bolt's log levels.
11
+ # See [Logs](logs.md) for more information about OpenBolt's log levels.
12
12
  #
13
13
  # > **Note:** Not available in apply block
14
14
  Puppet::Functions.create_function(:'log::trace') do
@@ -10,7 +10,7 @@ require 'bolt/util/format'
10
10
  # planning to make a breaking change to your plan in a future release and
11
11
  # want to notify users.
12
12
  #
13
- # See [Logs](logs.md) for more information about Bolt's log levels.
13
+ # See [Logs](logs.md) for more information about OpenBolt's log levels.
14
14
  #
15
15
  # > **Note:** Not available in apply block
16
16
  Puppet::Functions.create_function(:'log::warn') do
data/guides/targets.yaml CHANGED
@@ -16,6 +16,8 @@ guide: |
16
16
 
17
17
  The 'targets' option accepts a comma-separated list of target URIs or group
18
18
  names, or can read a target list from an input file '@<file>' or stdin '-'.
19
+ The input can also be a JSON array of target names or a Bolt result object
20
+ with an 'items' array where each item has a 'target' key.
19
21
  URIs can be specified with the format [protocol://][user@]host[:port]. To
20
22
  learn more about available protocols and their defaults, run 'bolt guide
21
23
  transports'.