openbolt 5.6.0 → 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.
- checksums.yaml +4 -4
- data/Puppetfile +35 -35
- data/bolt-modules/boltlib/lib/puppet/datatypes/result.rb +1 -1
- data/bolt-modules/boltlib/lib/puppet/datatypes/resultset.rb +2 -2
- data/bolt-modules/boltlib/lib/puppet/datatypes/target.rb +2 -2
- data/bolt-modules/boltlib/lib/puppet/functions/apply_prep.rb +2 -2
- data/bolt-modules/boltlib/lib/puppet/functions/background.rb +1 -1
- data/bolt-modules/boltlib/lib/puppet/functions/fail_plan.rb +1 -1
- data/bolt-modules/boltlib/lib/puppet/functions/get_resources.rb +1 -1
- data/bolt-modules/boltlib/lib/puppet/functions/puppetdb_command.rb +1 -1
- data/bolt-modules/boltlib/lib/puppet/functions/puppetdb_query.rb +1 -1
- data/bolt-modules/boltlib/lib/puppet/functions/run_plan.rb +27 -4
- data/bolt-modules/boltlib/lib/puppet/functions/run_task.rb +14 -22
- data/bolt-modules/boltlib/lib/puppet/functions/run_task_with.rb +14 -26
- data/bolt-modules/boltlib/lib/puppet/functions/wait.rb +2 -2
- data/bolt-modules/file/lib/puppet/functions/file/delete.rb +1 -1
- data/bolt-modules/file/lib/puppet/functions/file/exists.rb +1 -1
- data/bolt-modules/file/lib/puppet/functions/file/read.rb +1 -1
- data/bolt-modules/file/lib/puppet/functions/file/readable.rb +1 -1
- data/bolt-modules/file/lib/puppet/functions/file/write.rb +1 -1
- data/bolt-modules/log/lib/puppet/functions/log/debug.rb +1 -1
- data/bolt-modules/log/lib/puppet/functions/log/error.rb +1 -1
- data/bolt-modules/log/lib/puppet/functions/log/fatal.rb +1 -1
- data/bolt-modules/log/lib/puppet/functions/log/info.rb +1 -1
- data/bolt-modules/log/lib/puppet/functions/log/trace.rb +1 -1
- data/bolt-modules/log/lib/puppet/functions/log/warn.rb +1 -1
- data/guides/debugging.yaml +1 -1
- data/guides/inventory.yaml +2 -2
- data/guides/links.yaml +18 -9
- data/guides/logging.yaml +1 -1
- data/guides/module.yaml +1 -1
- data/guides/modulepath.yaml +1 -1
- data/guides/project.yaml +2 -2
- data/guides/targets.yaml +3 -1
- data/guides/transports.yaml +4 -3
- data/lib/bolt/analytics.rb +2 -10
- data/lib/bolt/bolt_option_parser.rb +66 -66
- data/lib/bolt/cli.rb +21 -2
- data/lib/bolt/config/options.rb +18 -18
- data/lib/bolt/config/transport/choria.rb +3 -0
- data/lib/bolt/config/transport/options.rb +34 -45
- data/lib/bolt/executor.rb +4 -0
- data/lib/bolt/fiber_executor.rb +46 -2
- data/lib/bolt/inventory/options.rb +1 -1
- data/lib/bolt/inventory/target.rb +1 -1
- data/lib/bolt/module_installer/puppetfile.rb +1 -1
- data/lib/bolt/module_installer/specs.rb +1 -1
- data/lib/bolt/outputter/human.rb +1 -2
- data/lib/bolt/plan_creator.rb +4 -4
- data/lib/bolt/plan_future.rb +5 -1
- data/lib/bolt/project_manager/inventory_migrator.rb +1 -1
- data/lib/bolt/project_manager/module_migrator.rb +1 -1
- data/lib/bolt/project_manager.rb +1 -1
- data/lib/bolt/shell/bash.rb +7 -4
- data/lib/bolt/shell/powershell/snippets.rb +20 -1
- data/lib/bolt/shell/powershell.rb +2 -2
- data/lib/bolt/transport/base.rb +9 -4
- data/lib/bolt/transport/choria/agent_discovery.rb +32 -14
- data/lib/bolt/transport/choria/bolt_tasks.rb +64 -40
- data/lib/bolt/transport/choria/client.rb +66 -49
- data/lib/bolt/transport/choria/command_builders.rb +144 -24
- data/lib/bolt/transport/choria/file_transfer.rb +134 -0
- data/lib/bolt/transport/choria/helpers.rb +25 -20
- data/lib/bolt/transport/choria/shell.rb +255 -148
- data/lib/bolt/transport/choria.rb +96 -27
- data/lib/bolt/transport/ssh/connection.rb +2 -1
- data/lib/bolt/util.rb +13 -0
- data/lib/bolt/version.rb +1 -1
- data/lib/bolt_spec/plans/mock_executor.rb +4 -0
- data/libexec/apply_catalog.rb +3 -0
- metadata +22 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ccffb09806ff6f277b75360ff8f804592795a3712ef3150e525e947673604737
|
|
4
|
+
data.tar.gz: 42fcccda83424540f1ebee736234a00570d4060e560f05ba06864385364c39ad
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e6af1fa2f0a8aeb236df11db580692c04b425c9fca04af1321636c488e3f46af603e47fee4ce604c721d0f5ff80cb2acaf076d1fd91a0ac54a76836c29981ee3
|
|
7
|
+
data.tar.gz: a76d500e92acd698776fe5b61d4be4bfe7dd5e6860025b4d0aeba2702e81dea893ec48362968908b52878e092c0c6edf25d0133b81c8d940c7e25bda81136570
|
data/Puppetfile
CHANGED
|
@@ -5,51 +5,51 @@ forge 'https://forge.puppetlabs.com'
|
|
|
5
5
|
moduledir File.join(File.dirname(__FILE__), 'modules')
|
|
6
6
|
|
|
7
7
|
# Core modules used by 'apply'
|
|
8
|
-
mod 'puppetlabs-service', '
|
|
9
|
-
mod 'puppet-openvox_bootstrap', '1.
|
|
10
|
-
mod 'puppetlabs-facts', '1.
|
|
8
|
+
mod 'puppetlabs-service', '4.0.0'
|
|
9
|
+
mod 'puppet-openvox_bootstrap', '1.8.0'
|
|
10
|
+
mod 'puppetlabs-facts', '1.8.1'
|
|
11
11
|
|
|
12
12
|
# Other core Puppet modules
|
|
13
|
-
mod 'puppetlabs-inifile', '6.
|
|
14
|
-
mod 'puppetlabs-apt', '11.
|
|
15
|
-
mod 'puppetlabs-stdlib', '
|
|
16
|
-
mod 'puppetlabs-powershell', '6.
|
|
17
|
-
mod 'puppetlabs-pwshlib', '2.
|
|
13
|
+
mod 'puppetlabs-inifile', '6.6.0'
|
|
14
|
+
mod 'puppetlabs-apt', '11.4.1'
|
|
15
|
+
mod 'puppetlabs-stdlib', '10.1.1'
|
|
16
|
+
mod 'puppetlabs-powershell', '6.2.0'
|
|
17
|
+
mod 'puppetlabs-pwshlib', '2.1.1'
|
|
18
18
|
|
|
19
19
|
# Core types and providers for Puppet 6
|
|
20
|
-
mod 'puppetlabs-augeas_core', '2.0
|
|
21
|
-
mod 'puppetlabs-host_core', '2.0
|
|
22
|
-
mod 'puppetlabs-scheduled_task', '
|
|
23
|
-
mod 'puppetlabs-sshkeys_core', '3.0
|
|
24
|
-
mod 'puppetlabs-zfs_core', '2.0
|
|
25
|
-
mod 'puppetlabs-cron_core', '2.0
|
|
26
|
-
mod 'puppetlabs-mount_core', '2.0
|
|
27
|
-
mod 'puppetlabs-selinux_core', '2.0
|
|
28
|
-
mod 'puppetlabs-yumrepo_core', '3.0
|
|
29
|
-
mod 'puppetlabs-zone_core', '2.0
|
|
20
|
+
mod 'puppetlabs-augeas_core', '2.1.0'
|
|
21
|
+
mod 'puppetlabs-host_core', '2.1.0'
|
|
22
|
+
mod 'puppetlabs-scheduled_task', '5.1.0'
|
|
23
|
+
mod 'puppetlabs-sshkeys_core', '3.1.0'
|
|
24
|
+
mod 'puppetlabs-zfs_core', '2.1.0'
|
|
25
|
+
mod 'puppetlabs-cron_core', '2.1.0'
|
|
26
|
+
mod 'puppetlabs-mount_core', '2.1.0'
|
|
27
|
+
mod 'puppetlabs-selinux_core', '2.1.0'
|
|
28
|
+
mod 'puppetlabs-yumrepo_core', '3.1.0'
|
|
29
|
+
mod 'puppetlabs-zone_core', '2.1.0'
|
|
30
30
|
|
|
31
31
|
# Useful additional modules
|
|
32
|
-
mod 'puppetlabs-package', '
|
|
33
|
-
mod 'puppetlabs-puppet_conf', '
|
|
34
|
-
mod 'puppetlabs-reboot', '
|
|
32
|
+
mod 'puppetlabs-package', '4.0.0'
|
|
33
|
+
mod 'puppetlabs-puppet_conf', '3.0.0'
|
|
34
|
+
mod 'puppetlabs-reboot', '6.1.0'
|
|
35
35
|
|
|
36
36
|
# Task helpers
|
|
37
|
-
mod 'puppetlabs-powershell_task_helper', '0.
|
|
38
|
-
mod 'puppetlabs-ruby_task_helper', '
|
|
39
|
-
mod 'puppetlabs-ruby_plugin_helper', '0.
|
|
40
|
-
mod 'puppetlabs-python_task_helper', '0.
|
|
41
|
-
mod 'puppetlabs-bash_task_helper', '2.
|
|
37
|
+
mod 'puppetlabs-powershell_task_helper', '0.2.0'
|
|
38
|
+
mod 'puppetlabs-ruby_task_helper', '1.1.0'
|
|
39
|
+
mod 'puppetlabs-ruby_plugin_helper', '0.4.0'
|
|
40
|
+
mod 'puppetlabs-python_task_helper', '0.7.0'
|
|
41
|
+
mod 'puppetlabs-bash_task_helper', '2.3.0'
|
|
42
42
|
|
|
43
43
|
# Plugin modules
|
|
44
|
-
mod 'puppetlabs-aws_inventory', '0.
|
|
45
|
-
mod 'puppetlabs-azure_inventory', '0.
|
|
46
|
-
mod 'puppetlabs-gcloud_inventory', '0.
|
|
47
|
-
mod 'puppetlabs-http_request', '0.
|
|
48
|
-
mod 'puppetlabs-pkcs7', '0.
|
|
49
|
-
mod 'puppetlabs-secure_env_vars', '0.
|
|
50
|
-
mod 'puppetlabs-terraform', '0.
|
|
51
|
-
mod 'puppetlabs-vault', '0.
|
|
52
|
-
mod 'puppetlabs-yaml', '0.
|
|
44
|
+
mod 'puppetlabs-aws_inventory', '0.9.0'
|
|
45
|
+
mod 'puppetlabs-azure_inventory', '0.6.0'
|
|
46
|
+
mod 'puppetlabs-gcloud_inventory', '0.4.0'
|
|
47
|
+
mod 'puppetlabs-http_request', '0.4.0'
|
|
48
|
+
mod 'puppetlabs-pkcs7', '0.2.0'
|
|
49
|
+
mod 'puppetlabs-secure_env_vars', '0.3.0'
|
|
50
|
+
mod 'puppetlabs-terraform', '0.8.0'
|
|
51
|
+
mod 'puppetlabs-vault', '0.5.0'
|
|
52
|
+
mod 'puppetlabs-yaml', '0.3.0'
|
|
53
53
|
|
|
54
54
|
# If we don't list these modules explicitly, r10k will purge them
|
|
55
55
|
mod 'canary', local: true
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# For each target that you execute an action on,
|
|
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,
|
|
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),
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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 = {})
|
|
@@ -81,32 +81,24 @@ Puppet::Functions.create_function(:run_task) do
|
|
|
81
81
|
return Bolt::ResultSet.new([])
|
|
82
82
|
end
|
|
83
83
|
|
|
84
|
-
#
|
|
85
|
-
|
|
86
|
-
if
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
[{ 'name' => '', 'path' => '' }])
|
|
90
|
-
else
|
|
91
|
-
# TODO: use the compiler injection once PUP-8237 lands
|
|
92
|
-
task_signature = Puppet::Pal::ScriptCompiler.new(closure_scope.compiler).task_signature(task_name)
|
|
93
|
-
if task_signature.nil?
|
|
94
|
-
raise Bolt::Error.unknown_task(task_name)
|
|
95
|
-
end
|
|
84
|
+
# TODO: use the compiler injection once PUP-8237 lands
|
|
85
|
+
task_signature = Puppet::Pal::ScriptCompiler.new(closure_scope.compiler).task_signature(task_name)
|
|
86
|
+
if task_signature.nil?
|
|
87
|
+
raise Bolt::Error.unknown_task(task_name)
|
|
88
|
+
end
|
|
96
89
|
|
|
97
|
-
|
|
90
|
+
task = Bolt::Task.from_task_signature(task_signature)
|
|
98
91
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
end
|
|
104
|
-
|
|
105
|
-
task_signature.runnable_with?(params) do |mismatch_message|
|
|
106
|
-
raise with_stack(:TYPE_MISMATCH, mismatch_message)
|
|
107
|
-
end || (raise with_stack(:TYPE_MISMATCH, 'Task parameters do not match'))
|
|
92
|
+
# Set the default value for any params that have one and were not provided
|
|
93
|
+
# or are undef.
|
|
94
|
+
params = task.parameter_defaults.merge(params) do |_, default, passed|
|
|
95
|
+
passed.nil? ? default : passed
|
|
108
96
|
end
|
|
109
97
|
|
|
98
|
+
task_signature.runnable_with?(params) do |mismatch_message|
|
|
99
|
+
raise with_stack(:TYPE_MISMATCH, mismatch_message)
|
|
100
|
+
end || (raise with_stack(:TYPE_MISMATCH, 'Task parameters do not match'))
|
|
101
|
+
|
|
110
102
|
# Generate a helpful error message about the type-mismatch between the type
|
|
111
103
|
# Data and the actual type of params.
|
|
112
104
|
unless Puppet::Pops::Types::TypeFactory.data.instance?(params)
|
|
@@ -13,8 +13,6 @@ require 'bolt/task'
|
|
|
13
13
|
# This function does nothing if the list of targets is empty.
|
|
14
14
|
#
|
|
15
15
|
# > **Note:** Not available in apply block
|
|
16
|
-
#
|
|
17
|
-
# > **Note:** Not available to targets using the pcp transport
|
|
18
16
|
Puppet::Functions.create_function(:run_task_with) do
|
|
19
17
|
# Run a task with target-specific parameters.
|
|
20
18
|
# @param task_name The task to run.
|
|
@@ -97,22 +95,14 @@ Puppet::Functions.create_function(:run_task_with) do
|
|
|
97
95
|
return Bolt::ResultSet.new([])
|
|
98
96
|
end
|
|
99
97
|
|
|
100
|
-
|
|
101
|
-
# Otherwise, load the local task definition
|
|
102
|
-
if (pcp_only = targets.all? { |t| t.transport == 'pcp' })
|
|
103
|
-
task = Bolt::Task.new(task_name,
|
|
104
|
-
{ 'supports_noop' => true },
|
|
105
|
-
[{ 'name' => '', 'path' => '' }])
|
|
106
|
-
else
|
|
107
|
-
task_signature = Puppet::Pal::ScriptCompiler.new(closure_scope.compiler).task_signature(task_name)
|
|
108
|
-
|
|
109
|
-
if task_signature.nil?
|
|
110
|
-
raise Bolt::Error.unknown_task(task_name)
|
|
111
|
-
end
|
|
98
|
+
task_signature = Puppet::Pal::ScriptCompiler.new(closure_scope.compiler).task_signature(task_name)
|
|
112
99
|
|
|
113
|
-
|
|
100
|
+
if task_signature.nil?
|
|
101
|
+
raise Bolt::Error.unknown_task(task_name)
|
|
114
102
|
end
|
|
115
103
|
|
|
104
|
+
task = Bolt::Task.from_task_signature(task_signature)
|
|
105
|
+
|
|
116
106
|
# Map the targets to their specific parameters and merge with the defaults
|
|
117
107
|
target_mapping = targets.each_with_object({}) do |target, mapping|
|
|
118
108
|
params = yield(target)
|
|
@@ -130,20 +120,18 @@ Puppet::Functions.create_function(:run_task_with) do
|
|
|
130
120
|
|
|
131
121
|
# If parameters are mismatched, create a failing result for the target that will later
|
|
132
122
|
# be added to the ResultSet.
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
end
|
|
138
|
-
|
|
139
|
-
type_match = task_signature.runnable_with?(params) do |mismatch_message|
|
|
140
|
-
exception = with_stack(:TYPE_MISMATCH, mismatch_message)
|
|
141
|
-
error_set << Bolt::Result.from_exception(target, exception, action: 'task')
|
|
142
|
-
end
|
|
123
|
+
# Set the default value for any params that have one and were not provided or are undef
|
|
124
|
+
params = task.parameter_defaults.merge(params) do |_, default, passed|
|
|
125
|
+
passed.nil? ? default : passed
|
|
126
|
+
end
|
|
143
127
|
|
|
144
|
-
|
|
128
|
+
type_match = task_signature.runnable_with?(params) do |mismatch_message|
|
|
129
|
+
exception = with_stack(:TYPE_MISMATCH, mismatch_message)
|
|
130
|
+
error_set << Bolt::Result.from_exception(target, exception, action: 'task')
|
|
145
131
|
end
|
|
146
132
|
|
|
133
|
+
next unless type_match
|
|
134
|
+
|
|
147
135
|
# If there is a type mismatch between the type Data and the type of the params, create
|
|
148
136
|
# a failing result for the target that will later be added to the ResultSet.
|
|
149
137
|
unless Puppet::Pops::Types::TypeFactory.data.instance?(params)
|
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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/debugging.yaml
CHANGED
data/guides/inventory.yaml
CHANGED
|
@@ -19,5 +19,5 @@ guide: |
|
|
|
19
19
|
is different than expected.
|
|
20
20
|
|
|
21
21
|
documentation:
|
|
22
|
-
- https://
|
|
23
|
-
- https://
|
|
22
|
+
- https://docs.openvoxproject.org/openbolt/latest/inventory_files.html
|
|
23
|
+
- https://docs.openvoxproject.org/openbolt/latest/bolt_inventory_reference.html
|
data/guides/links.yaml
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
---
|
|
2
2
|
topic: links
|
|
3
3
|
guide: |
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Reference
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
4
|
+
OpenBolt documentation
|
|
5
|
+
https://docs.openvoxproject.org/openbolt/latest/
|
|
6
|
+
Getting Started Guide
|
|
7
|
+
https://docs.openvoxproject.org/openbolt/latest/getting_started_with_bolt.html
|
|
8
|
+
Configuration Reference
|
|
9
|
+
https://docs.openvoxproject.org/openbolt/latest/configuring_bolt.html
|
|
10
|
+
Troubleshooting OpenBolt
|
|
11
|
+
https://docs.openvoxproject.org/openbolt/latest/troubleshooting.html
|
|
12
|
+
OpenBolt Developer Updates
|
|
13
|
+
https://docs.openvoxproject.org/openbolt/latest/developer_updates.html
|
|
14
|
+
OpenBolt Release Notes
|
|
15
|
+
https://docs.openvoxproject.org/openbolt/latest/release_notes.html
|
|
16
|
+
OpenBolt Examples
|
|
17
|
+
https://docs.openvoxproject.org/openbolt/latest/bolt_examples.html
|
|
18
|
+
Ask a question in #sig-openbolt
|
|
19
|
+
https://voxpupuli.org/connect/
|
|
20
|
+
Contribute at
|
|
21
|
+
https://github.com/OpenVoxProject/openbolt
|
data/guides/logging.yaml
CHANGED
data/guides/module.yaml
CHANGED
data/guides/modulepath.yaml
CHANGED
data/guides/project.yaml
CHANGED
|
@@ -17,5 +17,5 @@ guide: |
|
|
|
17
17
|
of a project.
|
|
18
18
|
|
|
19
19
|
documentation:
|
|
20
|
-
- https://
|
|
21
|
-
- https://
|
|
20
|
+
- https://docs.openvoxproject.org/openbolt/latest/projects.html
|
|
21
|
+
- https://docs.openvoxproject.org/openbolt/latest/bolt_project_reference.html
|
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'.
|
|
@@ -25,4 +27,4 @@ guide: |
|
|
|
25
27
|
see 'bolt guide inventory'.
|
|
26
28
|
|
|
27
29
|
documentation:
|
|
28
|
-
- https://
|
|
30
|
+
- https://docs.openvoxproject.org/openbolt/latest/running_bolt_commands.html
|
data/guides/transports.yaml
CHANGED
|
@@ -4,7 +4,8 @@ guide: |
|
|
|
4
4
|
Bolt uses transports (also known as protocols) to establish a connection
|
|
5
5
|
with a target in order to run actions on the target. The default transport is
|
|
6
6
|
SSH, and you can see available transports along with their configuration
|
|
7
|
-
options and defaults at
|
|
7
|
+
options and defaults at
|
|
8
|
+
https://docs.openvoxproject.org/openbolt/latest/bolt_transports_reference.html.
|
|
8
9
|
|
|
9
10
|
You can specify a transport for a target by prepending '<transport>://' to
|
|
10
11
|
the target's URI. For example, to connect to a target with hostname
|
|
@@ -18,5 +19,5 @@ guide: |
|
|
|
18
19
|
information about the Bolt inventory, run 'bolt guide inventory'.
|
|
19
20
|
|
|
20
21
|
documentation:
|
|
21
|
-
- https://
|
|
22
|
-
-
|
|
22
|
+
- https://docs.openvoxproject.org/openbolt/latest/running_bolt_commands.html#specify-a-transport
|
|
23
|
+
- https://docs.openvoxproject.org/openbolt/latest/inventory_files.html#transport-configuration
|