bolt 3.6.0 → 3.8.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 (48) 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 +10 -6
  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/applicator.rb +1 -1
  26. data/lib/bolt/bolt_option_parser.rb +353 -227
  27. data/lib/bolt/catalog.rb +2 -1
  28. data/lib/bolt/cli.rb +94 -36
  29. data/lib/bolt/config/options.rb +2 -1
  30. data/lib/bolt/config/transport/options.rb +2 -1
  31. data/lib/bolt/inventory.rb +5 -4
  32. data/lib/bolt/inventory/inventory.rb +3 -2
  33. data/lib/bolt/logger.rb +1 -1
  34. data/lib/bolt/module_installer/specs.rb +1 -1
  35. data/lib/bolt/module_installer/specs/git_spec.rb +10 -6
  36. data/lib/bolt/outputter/human.rb +58 -29
  37. data/lib/bolt/outputter/json.rb +8 -4
  38. data/lib/bolt/pal.rb +45 -0
  39. data/lib/bolt/pal/yaml_plan/step.rb +4 -2
  40. data/lib/bolt/plan_creator.rb +2 -2
  41. data/lib/bolt/puppetdb/client.rb +54 -0
  42. data/lib/bolt/result.rb +5 -0
  43. data/lib/bolt/shell/bash.rb +23 -10
  44. data/lib/bolt/transport/docker/connection.rb +2 -2
  45. data/lib/bolt/transport/ssh/connection.rb +3 -6
  46. data/lib/bolt/util.rb +73 -1
  47. data/lib/bolt/version.rb +1 -1
  48. metadata +7 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aa3e5ea7d868b032557568e9635fcf159f00b81e4961dce4032246cc150a7c16
4
- data.tar.gz: 0e9fada8a0518ab174412e21ec843091272cb0afe87980703ebd6d8ed91002dd
3
+ metadata.gz: f04dc4247f20f08ee8cfe33500b7ba9477963290ab5303b5f2c72ba60c529e1d
4
+ data.tar.gz: 4ebdf00f011c6d3de0e1b8e47f0763bfab04857fe4611391cf9bc800597c140e
5
5
  SHA512:
6
- metadata.gz: 66d8df12e0142b6d5872a40f7c0d97b0438c833e4681be6646e17b85496c3a9e1148ff0a2ff34572e0ce788861d928c406dddcb97feb5281ac0d7eb2d7d14ead
7
- data.tar.gz: f6dafaa37a4af7633610e26cc084d69c865f0b8df18221d407f2ee077e58e0a582e88cccf49d3a590e7984d56d8ac467ee8704e6ac0e60cc7e37b1a846396d26
6
+ metadata.gz: 5615936c79c5f157142e1703a83c9cf28e6ef2b91c090826130f57ac9dc636888847ddd87f01374053c768cf9d4e87a929f654126f6b37375ea1ae1cdc670530
7
+ data.tar.gz: 270c4669aff29a221c9a7711b7bac715bf6e821a01318f45866fdbadbf77e2e93424722db13b10812dc777d4dbc78c116be992f3a908365bc392820cbb6eeb0b
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.5.0'
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.4'
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.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,8 @@ 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
+ # @option options [String] _run_as User to run as using privilege escalation.
20
+ # @return [nil]
19
21
  # @example Prepare targets by name.
20
22
  # apply_prep('target1,target2')
21
23
  dispatch :apply_prep do
@@ -70,7 +72,8 @@ Puppet::Functions.create_function(:apply_prep) do
70
72
  .from_issue_and_stack(Bolt::PAL::Issues::PLAN_OPERATION_NOT_SUPPORTED_WHEN_COMPILING, action: 'apply_prep')
71
73
  end
72
74
 
73
- options = options.transform_keys { |k| k.sub(/^_/, '').to_sym }
75
+ # Unfreeze this
76
+ options = options.slice(*%w[_run_as _required_modules])
74
77
 
75
78
  applicator = Puppet.lookup(:apply_executor)
76
79
 
@@ -78,14 +81,14 @@ Puppet::Functions.create_function(:apply_prep) do
78
81
 
79
82
  targets = inventory.get_targets(target_spec)
80
83
 
81
- required_modules = options[:required_modules].nil? ? nil : Array(options[:required_modules])
82
- if required_modules&.any?
84
+ required_modules = options.delete('_required_modules').to_a
85
+ if required_modules.any?
83
86
  Puppet.debug("Syncing only required modules: #{required_modules.join(',')}.")
84
87
  end
85
88
 
86
89
  # Gather facts, including custom facts
87
90
  plugins = applicator.build_plugin_tarball do |mod|
88
- next unless required_modules.nil? || required_modules.include?(mod.name)
91
+ next unless required_modules.empty? || required_modules.include?(mod.name)
89
92
  search_dirs = []
90
93
  search_dirs << mod.plugins if mod.plugins?
91
94
  search_dirs << mod.pluginfacts if mod.pluginfacts?
@@ -106,8 +109,9 @@ Puppet::Functions.create_function(:apply_prep) do
106
109
  opts = t.plugin_hooks&.fetch('puppet_library').dup
107
110
  plugin_name = opts.delete('plugin')
108
111
  hook = inventory.plugins.get_hook(plugin_name, :puppet_library)
112
+ # Give plan function options precedence over inventory options
109
113
  { 'target' => t,
110
- 'hook_proc' => hook.call(opts, t, self) }
114
+ 'hook_proc' => hook.call(opts.merge(options), t, self) }
111
115
  rescue StandardError => e
112
116
  Bolt::Result.from_exception(t, e)
113
117
  end
@@ -131,7 +135,7 @@ Puppet::Functions.create_function(:apply_prep) do
131
135
 
132
136
  task = applicator.custom_facts_task
133
137
  arguments = { 'plugins' => Puppet::Pops::Types::PSensitiveType::Sensitive.new(plugins) }
134
- results = executor.run_task(targets, task, arguments)
138
+ results = run_task(targets, task, arguments, options)
135
139
 
136
140
  # TODO: Standardize RunFailure type with error above
137
141
  raise Bolt::RunFailure.new(results, 'run_task', task.name) unless results.ok?
@@ -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
- found = Puppet::Parser::Files.find_file(script, scope.compiler.environment)
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