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.
- checksums.yaml +4 -4
- data/Puppetfile +3 -3
- data/bolt-modules/boltlib/lib/puppet/datatypes/applyresult.rb +26 -0
- data/bolt-modules/boltlib/lib/puppet/datatypes/containerresult.rb +27 -0
- data/bolt-modules/boltlib/lib/puppet/datatypes/resourceinstance.rb +43 -0
- data/bolt-modules/boltlib/lib/puppet/datatypes/result.rb +29 -0
- data/bolt-modules/boltlib/lib/puppet/datatypes/resultset.rb +34 -0
- data/bolt-modules/boltlib/lib/puppet/datatypes/target.rb +55 -0
- data/bolt-modules/boltlib/lib/puppet/functions/add_to_group.rb +1 -0
- data/bolt-modules/boltlib/lib/puppet/functions/apply_prep.rb +1 -0
- data/bolt-modules/boltlib/lib/puppet/functions/parallelize.rb +1 -0
- data/bolt-modules/boltlib/lib/puppet/functions/puppetdb_command.rb +66 -0
- data/bolt-modules/boltlib/lib/puppet/functions/remove_from_group.rb +1 -0
- data/bolt-modules/boltlib/lib/puppet/functions/run_script.rb +5 -1
- data/bolt-modules/boltlib/lib/puppet/functions/upload_file.rb +5 -1
- data/bolt-modules/boltlib/lib/puppet/functions/write_file.rb +1 -0
- data/bolt-modules/ctrl/lib/puppet/functions/ctrl/do_until.rb +2 -0
- data/bolt-modules/file/lib/puppet/functions/file/exists.rb +9 -3
- data/bolt-modules/file/lib/puppet/functions/file/read.rb +6 -2
- data/bolt-modules/file/lib/puppet/functions/file/readable.rb +8 -3
- data/guides/guide.txt +17 -0
- data/guides/links.txt +13 -0
- data/guides/targets.txt +29 -0
- data/guides/transports.txt +23 -0
- data/lib/bolt/analytics.rb +4 -8
- data/lib/bolt/applicator.rb +1 -1
- data/lib/bolt/bolt_option_parser.rb +351 -225
- data/lib/bolt/catalog.rb +2 -1
- data/lib/bolt/cli.rb +122 -55
- data/lib/bolt/config.rb +11 -7
- data/lib/bolt/config/options.rb +41 -9
- data/lib/bolt/config/transport/podman.rb +33 -0
- data/lib/bolt/executor.rb +15 -11
- data/lib/bolt/inventory.rb +5 -4
- data/lib/bolt/inventory/inventory.rb +3 -2
- data/lib/bolt/module_installer/specs/git_spec.rb +10 -6
- data/lib/bolt/outputter/human.rb +194 -79
- data/lib/bolt/outputter/json.rb +10 -4
- data/lib/bolt/pal.rb +45 -0
- data/lib/bolt/pal/yaml_plan/step.rb +4 -2
- data/lib/bolt/plan_creator.rb +2 -2
- data/lib/bolt/plugin.rb +13 -11
- data/lib/bolt/puppetdb/client.rb +54 -0
- data/lib/bolt/result.rb +5 -0
- data/lib/bolt/shell/bash.rb +23 -10
- data/lib/bolt/transport/docker.rb +1 -1
- data/lib/bolt/transport/docker/connection.rb +10 -6
- data/lib/bolt/transport/podman.rb +19 -0
- data/lib/bolt/transport/podman/connection.rb +98 -0
- data/lib/bolt/transport/ssh/connection.rb +3 -6
- data/lib/bolt/util.rb +71 -0
- data/lib/bolt/version.rb +1 -1
- data/lib/bolt_server/transport_app.rb +3 -0
- data/lib/bolt_spec/plans/mock_executor.rb +2 -1
- metadata +10 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f4c856f3322c88dabb51efe39bc7373d96e33f6274785188900e8fbb5488436
|
4
|
+
data.tar.gz: 5e5da3f150093febfc2b6d7e343e9995ea33b044fb4941ed9229944e4735aa72
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f88f29b98a7bab28a4bbae5e860bb4c94fca20dd994241b71f2e5327934a92db1370c77fdb03d5f9a033e626b726e379e3eec510f0316b67b0807aa86920b67
|
7
|
+
data.tar.gz: 8cf9a3bbfde78b7930089a7ada109e03bba5439ea8ef3049d3fa58bc589914881969be783fe667ef5c238613e126c7f79d7dd0db30fcd2f5d9147999086d1df7
|
data/Puppetfile
CHANGED
@@ -6,7 +6,7 @@ moduledir File.join(File.dirname(__FILE__), 'modules')
|
|
6
6
|
|
7
7
|
# Core modules used by 'apply'
|
8
8
|
mod 'puppetlabs-service', '2.0.0'
|
9
|
-
mod 'puppetlabs-puppet_agent', '4.
|
9
|
+
mod 'puppetlabs-puppet_agent', '4.6.1'
|
10
10
|
mod 'puppetlabs-facts', '1.4.0'
|
11
11
|
|
12
12
|
# Core types and providers for Puppet 6
|
@@ -17,7 +17,7 @@ mod 'puppetlabs-sshkeys_core', '2.2.0'
|
|
17
17
|
mod 'puppetlabs-zfs_core', '1.2.0'
|
18
18
|
mod 'puppetlabs-cron_core', '1.0.5'
|
19
19
|
mod 'puppetlabs-mount_core', '1.0.4'
|
20
|
-
mod 'puppetlabs-selinux_core', '1.0
|
20
|
+
mod 'puppetlabs-selinux_core', '1.1.0'
|
21
21
|
mod 'puppetlabs-yumrepo_core', '1.0.7'
|
22
22
|
mod 'puppetlabs-zone_core', '1.0.3'
|
23
23
|
|
@@ -29,7 +29,7 @@ mod 'puppetlabs-python_task_helper', '0.5.0'
|
|
29
29
|
mod 'puppetlabs-reboot', '4.0.2'
|
30
30
|
mod 'puppetlabs-ruby_task_helper', '0.6.0'
|
31
31
|
mod 'puppetlabs-ruby_plugin_helper', '0.2.0'
|
32
|
-
mod 'puppetlabs-stdlib', '7.0.
|
32
|
+
mod 'puppetlabs-stdlib', '7.0.1'
|
33
33
|
|
34
34
|
# Plugin modules
|
35
35
|
mod 'puppetlabs-aws_inventory', '0.7.0'
|
@@ -1,5 +1,31 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# An [apply action](applying_manifest_blocks.md#return-value-of-apply-action)
|
4
|
+
# returns an `ApplyResult`. An `ApplyResult` is part of a `ResultSet` object and
|
5
|
+
# contains information about the apply action.
|
6
|
+
#
|
7
|
+
# @param report
|
8
|
+
# The Puppet report from the apply action. Equivalent to calling `ApplyResult.value['report']`.
|
9
|
+
# The report is a hash representation of the [`Puppet::Transaction::Report`
|
10
|
+
# object](https://puppet.com/docs/puppet/latest/format_report.html), where each property
|
11
|
+
# corresponds to a key in the report hash. For more information, see [Result
|
12
|
+
# keys](applying_manifest_blocks.md#result-keys).
|
13
|
+
# @param target
|
14
|
+
# The target the result is from.
|
15
|
+
#
|
16
|
+
# @!method action
|
17
|
+
# The action performed. `ApplyResult.action` always returns the string `apply`.
|
18
|
+
# @!method error
|
19
|
+
# Returns an Error object constructed from the `_error` field of the result's value.
|
20
|
+
# @!method message
|
21
|
+
# The `_output` field of the result's value.
|
22
|
+
# @!method ok
|
23
|
+
# Whether the result was successful.
|
24
|
+
# @!method to_data
|
25
|
+
# A serialized representation of `ApplyResult`.
|
26
|
+
# @!method value
|
27
|
+
# A hash including the Puppet report from the apply action under a `report` key.
|
28
|
+
#
|
3
29
|
Puppet::DataTypes.create_type('ApplyResult') do
|
4
30
|
interface <<-PUPPET
|
5
31
|
attributes => {
|
@@ -1,5 +1,32 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# The [run_container](plan_functions.md#run_container) plan function returns a
|
4
|
+
# `ContainerResult` object. A `ContainerResult` is a standalone object (not part
|
5
|
+
# of a `ResultSet`) that includes either the `stdout` and `stderr` values from
|
6
|
+
# running the container, or an `_error` object if the container exited with a
|
7
|
+
# nonzero exit code.
|
8
|
+
#
|
9
|
+
# @param value
|
10
|
+
# A hash including the `stdout`, `stderr`, and `exit_code` received from the
|
11
|
+
# container.
|
12
|
+
#
|
13
|
+
# @!method []
|
14
|
+
# Accesses the value hash directly and returns the value for the key. This
|
15
|
+
# function does not use dot notation. Call the function directly on the
|
16
|
+
# `ContainerResult`. For example, `$result[key]`.
|
17
|
+
# @!method error
|
18
|
+
# An object constructed from the `_error` field of the result's value.
|
19
|
+
# @!method ok
|
20
|
+
# Whether the result was successful.
|
21
|
+
# @!method status
|
22
|
+
# Either `success` if the result was successful or `failure`.
|
23
|
+
# @!method stdout
|
24
|
+
# The value of 'stdout' output by the container.
|
25
|
+
# @!method stderr
|
26
|
+
# The value of 'stderr' output by the container.
|
27
|
+
# @!method to_data
|
28
|
+
# A serialized representation of `ContainerResult`.
|
29
|
+
#
|
3
30
|
Puppet::DataTypes.create_type('ContainerResult') do
|
4
31
|
interface <<-PUPPET
|
5
32
|
attributes => {
|
@@ -1,5 +1,48 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# `ResourceInstance` objects are used to store the observed and desired state of a
|
4
|
+
# target's resource and to track events for the resource. These objects do not
|
5
|
+
# modify or interact with a target's resources.
|
6
|
+
#
|
7
|
+
# > The `ResourceInstance` data type is experimental and might change in a future
|
8
|
+
# > release. You can learn more about this data type and how to use it in the
|
9
|
+
# > [experimental features
|
10
|
+
# > documentation](experimental_features.md#resourceinstance-data-type).
|
11
|
+
#
|
12
|
+
# @param events
|
13
|
+
# Events for the resource.
|
14
|
+
# @param desired_state
|
15
|
+
# [Attributes](https://puppet.com/docs/puppet/latest/lang_resources.html#attributes) describing
|
16
|
+
# the desired state of the resource.
|
17
|
+
# @param state
|
18
|
+
# [Attributes](https://puppet.com/docs/puppet/latest/lang_resources.html#attributes) describing
|
19
|
+
# the observed state of the resource.
|
20
|
+
# @param target
|
21
|
+
# The resource's target.
|
22
|
+
# @param title
|
23
|
+
# The [resource title](https://puppet.com/docs/puppet/latest/lang_resources.html#title).
|
24
|
+
# @param type
|
25
|
+
# The [resource type](https://puppet.com/docs/puppet/latest/lang_resources.html#resource-types).
|
26
|
+
#
|
27
|
+
# @!method []
|
28
|
+
# Accesses the `state` hash directly and returns the value for the specified
|
29
|
+
# attribute. This function does not use dot noation. Call the function directly
|
30
|
+
# on the `ResourceInstance`. For example, `$resource['ensure']`.
|
31
|
+
# @!method add_event(event)
|
32
|
+
# Add an event for the resource.
|
33
|
+
# @!method overwrite_desired_state(desired_state)
|
34
|
+
# Overwrites the desired state of the resource.
|
35
|
+
# @!method overwrite_state(state)
|
36
|
+
# Overwrites the observed state of the resource.
|
37
|
+
# @!method set_desired_state(desired_state)
|
38
|
+
# Sets attributes describing the desired state of the resource. Performs a shallow
|
39
|
+
# merge with existing desired state.
|
40
|
+
# @!method set_state(state)
|
41
|
+
# Sets attributes describing the observed state of the resource. Performs a shallow
|
42
|
+
# merge with existing state.
|
43
|
+
# @!method reference
|
44
|
+
# The resources reference string. For example, `File[/etc/puppetlabs]`.
|
45
|
+
#
|
3
46
|
Puppet::DataTypes.create_type('ResourceInstance') do
|
4
47
|
interface <<-PUPPET
|
5
48
|
attributes => {
|
@@ -1,5 +1,34 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# For each target that you execute an action on, Bolt returns a `Result` object
|
4
|
+
# and adds the `Result` to a `ResultSet` object. A `Result` object contains
|
5
|
+
# information about the action you executed on the target.
|
6
|
+
#
|
7
|
+
# @param target
|
8
|
+
# The target the result is from.
|
9
|
+
# @param value
|
10
|
+
# The output or return of executing on the target.
|
11
|
+
#
|
12
|
+
# @!method []
|
13
|
+
# Accesses the `value` hash directly and returns the value for the key. This
|
14
|
+
# function does not use dot nation. Call the function directly on the `Result`.
|
15
|
+
# For example, `$result['key']`.
|
16
|
+
# @!method action
|
17
|
+
# The type of result. For example, `task` or `command`.
|
18
|
+
# @!method error
|
19
|
+
# An object constructed from the `_error` field of the result's `value`.
|
20
|
+
# @!method message
|
21
|
+
# The `_output` field of the result's value.
|
22
|
+
# @!method ok
|
23
|
+
# Whether the result was successful.
|
24
|
+
# @!method sensitive
|
25
|
+
# The `_sensitive` field of the result's value, wrapped in a `Sensitive` object.
|
26
|
+
# Call `unwrap()` to extract the value.
|
27
|
+
# @!method status
|
28
|
+
# Either `success` if the result was successful or `failure`.
|
29
|
+
# @!method to_data
|
30
|
+
# A serialized representation of `Result`.
|
31
|
+
#
|
3
32
|
Puppet::DataTypes.create_type('Result') do
|
4
33
|
interface <<-PUPPET
|
5
34
|
attributes => {
|
@@ -1,5 +1,39 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# For each target that you execute an action on, Bolt returns a `Result` object
|
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
|
6
|
+
# more `ApplyResult` objects.
|
7
|
+
#
|
8
|
+
# @param results
|
9
|
+
# All results in the set.
|
10
|
+
#
|
11
|
+
# @!method []
|
12
|
+
# The accessed results. This function does not use dot notation. Call the
|
13
|
+
# function directly on the `ResultSet`. For example, `$results[0]`.
|
14
|
+
# @!method count
|
15
|
+
# The number of results in the set.
|
16
|
+
# @!method empty
|
17
|
+
# Whether the set is empty.
|
18
|
+
# @!method error_set
|
19
|
+
# The set of failing results.
|
20
|
+
# @!method filter_set
|
21
|
+
# Filters a set of results by the contents of the block.
|
22
|
+
# @!method find(target_name)
|
23
|
+
# Retrieves a result for a specified target.
|
24
|
+
# @!method first
|
25
|
+
# The first result in the set. Useful for unwrapping single results.
|
26
|
+
# @!method names
|
27
|
+
# The names of all targets that have a `Result` in the set.
|
28
|
+
# @!method ok
|
29
|
+
# Whether all results were successful. Equivalent to `$results.error_set.empty`.
|
30
|
+
# @!method ok_set
|
31
|
+
# The set of successful results.
|
32
|
+
# @!method targets
|
33
|
+
# The list of targets that have results in the set.
|
34
|
+
# @!method to_data
|
35
|
+
# An array of serialized representations of each result in the set.
|
36
|
+
#
|
3
37
|
Puppet::DataTypes.create_type('ResultSet') do
|
4
38
|
interface <<-PUPPET
|
5
39
|
attributes => {
|
@@ -1,5 +1,60 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# The `Target` object represents a target and its specific connection options.
|
4
|
+
#
|
5
|
+
# @param config
|
6
|
+
# The inventory configuration for the target. This function returns the
|
7
|
+
# configuration set directly on the target in `inventory.yaml` or set in
|
8
|
+
# a plan using `Target.new` or `set_config()`. It does not return default
|
9
|
+
# configuration values or configuration set in Bolt configuration files.
|
10
|
+
# @param facts
|
11
|
+
# The target's facts. This function does not look up facts for a target and
|
12
|
+
# only returns the facts specified in an `inventory.yaml` file or set on a
|
13
|
+
# target during a plan run. To retrieve facts for a target and set them in
|
14
|
+
# inventory, run the [facts](writing_plans.md#collect-facts-from-targets)
|
15
|
+
# plan or [puppetdb_fact](writing_plans.md#collect-facts-from-puppetdb)
|
16
|
+
# plan.
|
17
|
+
# @param features
|
18
|
+
# The target's features.
|
19
|
+
# @param name
|
20
|
+
# The target's human-readable name, or its URI if a name was not given.
|
21
|
+
# @param plugin_hooks
|
22
|
+
# The target's `plugin_hooks` [configuration
|
23
|
+
# options](bolt_inventory_reference.md#plugin-hooks-1).
|
24
|
+
# @param resources
|
25
|
+
# The target's resources. This function does not look up resources for a
|
26
|
+
# target and only returns resources set on a target during a plan run.
|
27
|
+
# @param safe_name
|
28
|
+
# The target's safe name. Equivalent to `name` if a name was given, or the
|
29
|
+
# target's `uri` with any password omitted.
|
30
|
+
# @param target_alias
|
31
|
+
# The target's aliases.
|
32
|
+
# @param uri
|
33
|
+
# The target's URI.
|
34
|
+
# @param vars
|
35
|
+
# The target's variables.
|
36
|
+
#
|
37
|
+
# @!method host
|
38
|
+
# The target's hostname.
|
39
|
+
# @!method password
|
40
|
+
# The password to use when connecting to the target.
|
41
|
+
# @!method port
|
42
|
+
# The target's connection port.
|
43
|
+
# @!method protocol
|
44
|
+
# The protocol used to connect to the target. This is equivalent to the target's
|
45
|
+
# `transport`, expect for targets using the `remote` transport. For example,
|
46
|
+
# a target with the URI `http://example.com` using the `remote` transport would
|
47
|
+
# return `http` for the `protocol`.
|
48
|
+
# @!method transport
|
49
|
+
# The transport used to connect to the target.
|
50
|
+
# @!method transport_config
|
51
|
+
# The merged configuration for the target's `transport`. This function returns
|
52
|
+
# configuration that includes defaults set by Bolt, configuration set in
|
53
|
+
# `inventory.yaml`, configuration set in `bolt-defaults.yaml`, and configuration
|
54
|
+
# set in a plan using `set_config()`.
|
55
|
+
# @!method user
|
56
|
+
# The user to connect to the target.
|
57
|
+
#
|
3
58
|
Puppet::DataTypes.create_type('Target') do
|
4
59
|
begin
|
5
60
|
inventory = Puppet.lookup(:bolt_inventory)
|
@@ -8,6 +8,7 @@ require 'bolt/error'
|
|
8
8
|
Puppet::Functions.create_function(:add_to_group) do
|
9
9
|
# @param targets A pattern or array of patterns identifying a set of targets.
|
10
10
|
# @param group The name of the group to add targets to.
|
11
|
+
# @return [Array[Target]] The targets.
|
11
12
|
# @example Add new Target to group.
|
12
13
|
# Target.new('foo@example.com', 'password' => 'secret').add_to_group('group1')
|
13
14
|
# @example Add new target to group by name.
|
@@ -16,6 +16,7 @@ Puppet::Functions.create_function(:apply_prep) do
|
|
16
16
|
# @param targets A pattern or array of patterns identifying a set of targets.
|
17
17
|
# @param options Options hash.
|
18
18
|
# @option options [Array] _required_modules An array of modules to sync to the target.
|
19
|
+
# @return [nil]
|
19
20
|
# @example Prepare targets by name.
|
20
21
|
# apply_prep('target1,target2')
|
21
22
|
dispatch :apply_prep do
|
@@ -10,6 +10,7 @@ Puppet::Functions.create_function(:parallelize, Puppet::Functions::InternalFunct
|
|
10
10
|
# Map a block onto an array, where each array element executes in parallel.
|
11
11
|
# This function is experimental.
|
12
12
|
# @param data The array to apply the block to.
|
13
|
+
# @param block The code block to execute for each array element.
|
13
14
|
# @return [Array] An array of PlanResult objects. Each input from the input
|
14
15
|
# array returns a corresponding PlanResult object.
|
15
16
|
# @example Execute two tasks on two targets.
|
@@ -0,0 +1,66 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'bolt/error'
|
4
|
+
|
5
|
+
# Send a command with a payload to PuppetDB.
|
6
|
+
#
|
7
|
+
# The `pdb_command` function only supports version 5 of the `replace_facts`
|
8
|
+
# command. Other commands might also work, but are not tested or supported
|
9
|
+
# by Bolt.
|
10
|
+
#
|
11
|
+
# See the [commands endpoint](https://puppet.com/docs/puppetdb/latest/api/command/v1/commands.html)
|
12
|
+
# documentation for more information about available commands and payload
|
13
|
+
# format.
|
14
|
+
#
|
15
|
+
# _This function is experimental and subject to change._
|
16
|
+
#
|
17
|
+
# > **Note:** Not available in apply block
|
18
|
+
#
|
19
|
+
Puppet::Functions.create_function(:puppetdb_command) do
|
20
|
+
# @param command The command to invoke.
|
21
|
+
# @param version The version of the command to invoke.
|
22
|
+
# @param payload The payload to the command.
|
23
|
+
# @return The UUID identifying the response sent by PuppetDB.
|
24
|
+
# @example Replace facts for a target
|
25
|
+
# $payload = {
|
26
|
+
# 'certname' => 'localhost',
|
27
|
+
# 'environment' => 'dev',
|
28
|
+
# 'producer' => 'bolt',
|
29
|
+
# 'producer_timestamp' => '1970-01-01',
|
30
|
+
# 'values' => { 'orchestrator' => 'bolt' }
|
31
|
+
# }
|
32
|
+
#
|
33
|
+
# puppetdb_command('replace_facts', 5, $payload)
|
34
|
+
dispatch :puppetdb_command do
|
35
|
+
param 'String[1]', :command
|
36
|
+
param 'Integer', :version
|
37
|
+
param 'Hash[Data, Data]', :payload
|
38
|
+
return_type 'String'
|
39
|
+
end
|
40
|
+
|
41
|
+
def puppetdb_command(command, version, payload)
|
42
|
+
# Disallow in apply blocks.
|
43
|
+
unless Puppet[:tasks]
|
44
|
+
raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
|
45
|
+
Bolt::PAL::Issues::PLAN_OPERATION_NOT_SUPPORTED_WHEN_COMPILING,
|
46
|
+
action: 'puppetdb_command'
|
47
|
+
)
|
48
|
+
end
|
49
|
+
|
50
|
+
# Send analytics report.
|
51
|
+
Puppet.lookup(:bolt_executor).report_function_call(self.class.name)
|
52
|
+
|
53
|
+
puppetdb_client = Puppet.lookup(:bolt_pdb_client)
|
54
|
+
|
55
|
+
# Error if the PDB client does not implement :send_command
|
56
|
+
unless puppetdb_client.respond_to?(:send_command)
|
57
|
+
raise Bolt::Error.new(
|
58
|
+
"PuppetDB client #{puppetdb_client.class} does not implement :send_command, "\
|
59
|
+
"unable to invoke command.",
|
60
|
+
'bolt/pdb-command'
|
61
|
+
)
|
62
|
+
end
|
63
|
+
|
64
|
+
puppetdb_client.send_command(command, version, payload)
|
65
|
+
end
|
66
|
+
end
|
@@ -11,6 +11,7 @@ require 'bolt/error'
|
|
11
11
|
Puppet::Functions.create_function(:remove_from_group) do
|
12
12
|
# @param target A pattern identifying a single target.
|
13
13
|
# @param group The name of the group to remove the target from.
|
14
|
+
# @return [nil]
|
14
15
|
# @example Remove Target from group.
|
15
16
|
# remove_from_group('foo@example.com', 'group1')
|
16
17
|
# @example Remove failing Targets from the rest of a plan
|
@@ -108,7 +108,11 @@ Puppet::Functions.create_function(:run_script, Puppet::Functions::InternalFuncti
|
|
108
108
|
# Send Analytics Report
|
109
109
|
executor.report_function_call(self.class.name)
|
110
110
|
|
111
|
-
|
111
|
+
future = executor&.future || {}
|
112
|
+
fallback = future.fetch('file_paths', false)
|
113
|
+
|
114
|
+
# Find the file path if it exists, otherwise return nil
|
115
|
+
found = Bolt::Util.find_file_from_scope(script, scope, fallback)
|
112
116
|
unless found && Puppet::FileSystem.exist?(found)
|
113
117
|
raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
|
114
118
|
Puppet::Pops::Issues::NO_SUCH_FILE_OR_DIRECTORY, file: script
|
@@ -70,7 +70,11 @@ Puppet::Functions.create_function(:upload_file, Puppet::Functions::InternalFunct
|
|
70
70
|
# Send Analytics Report
|
71
71
|
executor.report_function_call(self.class.name)
|
72
72
|
|
73
|
-
|
73
|
+
future = executor&.future || {}
|
74
|
+
fallback = future.fetch('file_paths', false)
|
75
|
+
|
76
|
+
# Find the file path if it exists, otherwise return nil
|
77
|
+
found = Bolt::Util.find_file_from_scope(source, scope, fallback)
|
74
78
|
unless found && Puppet::FileSystem.exist?(found)
|
75
79
|
raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
|
76
80
|
Puppet::Pops::Issues::NO_SUCH_FILE_OR_DIRECTORY, file: source
|
@@ -9,6 +9,7 @@ Puppet::Functions.create_function(:write_file) do
|
|
9
9
|
# @param content File content to write.
|
10
10
|
# @param destination An absolute path on the target(s).
|
11
11
|
# @param targets A pattern identifying zero or more targets. See {get_targets} for accepted patterns.
|
12
|
+
# @param options A hash of additional options.
|
12
13
|
# @option options [Boolean] _catch_errors Whether to catch raised errors.
|
13
14
|
# @option options [String] _run_as User to run as using privilege escalation.
|
14
15
|
# @return A list of results, one entry per target.
|
@@ -3,8 +3,10 @@
|
|
3
3
|
# Repeat the block until it returns a truthy value. Returns the value.
|
4
4
|
Puppet::Functions.create_function(:'ctrl::do_until') do
|
5
5
|
# @param options A hash of additional options.
|
6
|
+
# @param block The code block to repeat.
|
6
7
|
# @option options [Numeric] limit The number of times to repeat the block.
|
7
8
|
# @option options [Numeric] interval The number of seconds to wait before repeating the block.
|
9
|
+
# @return [nil]
|
8
10
|
# @example Run a task until it succeeds
|
9
11
|
# ctrl::do_until() || {
|
10
12
|
# run_task('test', $target, '_catch_errors' => true).ok()
|