bolt 2.15.0 → 2.20.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/bolt-modules/boltlib/lib/puppet/functions/add_facts.rb +1 -0
- data/bolt-modules/boltlib/lib/puppet/functions/add_to_group.rb +1 -0
- data/bolt-modules/boltlib/lib/puppet/functions/apply_prep.rb +20 -9
- data/bolt-modules/boltlib/lib/puppet/functions/catch_errors.rb +1 -0
- data/bolt-modules/boltlib/lib/puppet/functions/download_file.rb +123 -0
- data/bolt-modules/boltlib/lib/puppet/functions/facts.rb +1 -0
- data/bolt-modules/boltlib/lib/puppet/functions/fail_plan.rb +1 -0
- data/bolt-modules/boltlib/lib/puppet/functions/get_resources.rb +1 -0
- data/bolt-modules/boltlib/lib/puppet/functions/get_target.rb +1 -0
- data/bolt-modules/boltlib/lib/puppet/functions/get_targets.rb +1 -0
- data/bolt-modules/boltlib/lib/puppet/functions/puppetdb_fact.rb +1 -0
- data/bolt-modules/boltlib/lib/puppet/functions/puppetdb_query.rb +1 -0
- data/bolt-modules/boltlib/lib/puppet/functions/remove_from_group.rb +1 -0
- data/bolt-modules/boltlib/lib/puppet/functions/resolve_references.rb +1 -0
- data/bolt-modules/boltlib/lib/puppet/functions/resource.rb +1 -0
- data/bolt-modules/boltlib/lib/puppet/functions/run_command.rb +3 -0
- data/bolt-modules/boltlib/lib/puppet/functions/run_plan.rb +2 -1
- data/bolt-modules/boltlib/lib/puppet/functions/run_script.rb +7 -4
- data/bolt-modules/boltlib/lib/puppet/functions/run_task.rb +2 -1
- data/bolt-modules/boltlib/lib/puppet/functions/set_config.rb +1 -0
- data/bolt-modules/boltlib/lib/puppet/functions/set_feature.rb +1 -0
- data/bolt-modules/boltlib/lib/puppet/functions/set_resources.rb +1 -0
- data/bolt-modules/boltlib/lib/puppet/functions/set_var.rb +1 -0
- data/bolt-modules/boltlib/lib/puppet/functions/upload_file.rb +1 -0
- data/bolt-modules/boltlib/lib/puppet/functions/vars.rb +1 -0
- data/bolt-modules/boltlib/lib/puppet/functions/wait_until_available.rb +1 -0
- data/bolt-modules/boltlib/lib/puppet/functions/without_default_logging.rb +1 -0
- 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/ctrl/lib/puppet/functions/ctrl/sleep.rb +2 -0
- data/bolt-modules/file/lib/puppet/functions/file/exists.rb +1 -0
- data/bolt-modules/file/lib/puppet/functions/file/join.rb +2 -0
- data/bolt-modules/file/lib/puppet/functions/file/read.rb +2 -0
- data/bolt-modules/file/lib/puppet/functions/file/readable.rb +2 -0
- data/bolt-modules/file/lib/puppet/functions/file/write.rb +2 -0
- data/bolt-modules/out/lib/puppet/functions/out/message.rb +2 -0
- data/bolt-modules/prompt/lib/puppet/functions/prompt.rb +1 -0
- data/bolt-modules/system/lib/puppet/functions/system/env.rb +2 -0
- data/lib/bolt/applicator.rb +21 -15
- data/lib/bolt/apply_result.rb +1 -1
- data/lib/bolt/bolt_option_parser.rb +55 -20
- data/lib/bolt/catalog.rb +3 -2
- data/lib/bolt/cli.rb +116 -47
- data/lib/bolt/config.rb +48 -148
- data/lib/bolt/config/options.rb +488 -0
- data/lib/bolt/config/transport/base.rb +16 -16
- data/lib/bolt/config/transport/docker.rb +9 -23
- data/lib/bolt/config/transport/local.rb +6 -44
- data/lib/bolt/config/transport/options.rb +460 -0
- data/lib/bolt/config/transport/orch.rb +9 -18
- data/lib/bolt/config/transport/remote.rb +3 -6
- data/lib/bolt/config/transport/ssh.rb +74 -154
- data/lib/bolt/config/transport/winrm.rb +18 -47
- data/lib/bolt/executor.rb +15 -0
- data/lib/bolt/inventory/group.rb +4 -3
- data/lib/bolt/inventory/inventory.rb +4 -17
- data/lib/bolt/inventory/target.rb +18 -5
- data/lib/bolt/logger.rb +24 -1
- data/lib/bolt/outputter.rb +1 -1
- data/lib/bolt/outputter/rainbow.rb +14 -3
- data/lib/bolt/pal.rb +31 -11
- data/lib/bolt/pal/yaml_plan/evaluator.rb +19 -2
- data/lib/bolt/pal/yaml_plan/step.rb +11 -2
- data/lib/bolt/pal/yaml_plan/step/download.rb +38 -0
- data/lib/bolt/pal/yaml_plan/step/upload.rb +3 -3
- data/lib/bolt/plugin/module.rb +2 -4
- data/lib/bolt/plugin/puppetdb.rb +3 -2
- data/lib/bolt/project.rb +41 -44
- data/lib/bolt/puppetdb/client.rb +2 -0
- data/lib/bolt/puppetdb/config.rb +16 -0
- data/lib/bolt/result.rb +7 -0
- data/lib/bolt/shell/bash.rb +53 -45
- data/lib/bolt/shell/powershell.rb +23 -12
- data/lib/bolt/shell/powershell/snippets.rb +15 -6
- data/lib/bolt/transport/base.rb +24 -0
- data/lib/bolt/transport/docker.rb +17 -5
- data/lib/bolt/transport/docker/connection.rb +20 -2
- data/lib/bolt/transport/local/connection.rb +14 -1
- data/lib/bolt/transport/orch.rb +20 -0
- data/lib/bolt/transport/simple.rb +6 -0
- data/lib/bolt/transport/ssh.rb +7 -1
- data/lib/bolt/transport/ssh/connection.rb +9 -1
- data/lib/bolt/transport/ssh/exec_connection.rb +23 -2
- data/lib/bolt/transport/winrm/connection.rb +109 -8
- data/lib/bolt/util.rb +26 -11
- data/lib/bolt/version.rb +1 -1
- data/lib/bolt_server/transport_app.rb +3 -2
- data/lib/bolt_spec/bolt_context.rb +7 -2
- data/lib/bolt_spec/plans.rb +15 -2
- data/lib/bolt_spec/plans/action_stubs.rb +2 -1
- data/lib/bolt_spec/plans/action_stubs/download_stub.rb +66 -0
- data/lib/bolt_spec/plans/mock_executor.rb +14 -1
- data/lib/bolt_spec/run.rb +22 -0
- data/libexec/bolt_catalog +3 -2
- metadata +20 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a72c179da8e6e3fd3d8f883366e88f98026de00eee08ae2410515b2103a3810d
|
4
|
+
data.tar.gz: 968edc1c0c30a370ed06b1c9bd5498ccaaaa5e15f3c47307cad1e68f2af5dafb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a906282180c5df824978979d8e12da5cbe2f835ccef2ae65f2e2fc892bcfa1514a4f8f76418b866fe9cbfe8ce8f8f28b66306055b7acc67de6a7a2e13bb7edbf
|
7
|
+
data.tar.gz: ee4c33740e8e29ad4b3026e5b75b3f0d29556c92e9277bc34101c5f8acfe80db599389c8544aab5946c6c444502a49ddb515da0a854b5796b0aae54fc0875ffc
|
@@ -29,6 +29,7 @@ Puppet::Functions.create_function(:add_to_group) do
|
|
29
29
|
|
30
30
|
inventory = Puppet.lookup(:bolt_inventory)
|
31
31
|
executor = Puppet.lookup(:bolt_executor)
|
32
|
+
# Send Analytics Report
|
32
33
|
executor.report_function_call(self.class.name)
|
33
34
|
|
34
35
|
inventory.add_to_group(inventory.get_targets(targets), group)
|
@@ -13,10 +13,13 @@ require 'bolt/task'
|
|
13
13
|
# > **Note:** Not available in apply block
|
14
14
|
Puppet::Functions.create_function(:apply_prep) do
|
15
15
|
# @param targets A pattern or array of patterns identifying a set of targets.
|
16
|
+
# @param options Options hash.
|
17
|
+
# @option options [Array] _required_modules An array of modules to sync to the target.
|
16
18
|
# @example Prepare targets by name.
|
17
19
|
# apply_prep('target1,target2')
|
18
20
|
dispatch :apply_prep do
|
19
21
|
param 'Boltlib::TargetSpec', :targets
|
22
|
+
optional_param 'Hash[String, Data]', :options
|
20
23
|
end
|
21
24
|
|
22
25
|
def script_compiler
|
@@ -60,18 +63,34 @@ Puppet::Functions.create_function(:apply_prep) do
|
|
60
63
|
@executor ||= Puppet.lookup(:bolt_executor)
|
61
64
|
end
|
62
65
|
|
63
|
-
def apply_prep(target_spec)
|
66
|
+
def apply_prep(target_spec, options = {})
|
64
67
|
unless Puppet[:tasks]
|
65
68
|
raise Puppet::ParseErrorWithIssue
|
66
69
|
.from_issue_and_stack(Bolt::PAL::Issues::PLAN_OPERATION_NOT_SUPPORTED_WHEN_COMPILING, action: 'apply_prep')
|
67
70
|
end
|
68
71
|
|
72
|
+
options = options.transform_keys { |k| k.sub(/^_/, '').to_sym }
|
73
|
+
|
69
74
|
applicator = Puppet.lookup(:apply_executor)
|
70
75
|
|
71
76
|
executor.report_function_call(self.class.name)
|
72
77
|
|
73
78
|
targets = inventory.get_targets(target_spec)
|
74
79
|
|
80
|
+
required_modules = options[:required_modules].nil? ? nil : Array(options[:required_modules])
|
81
|
+
if required_modules&.any?
|
82
|
+
Puppet.debug("Syncing only required modules: #{required_modules.join(',')}.")
|
83
|
+
end
|
84
|
+
|
85
|
+
# Gather facts, including custom facts
|
86
|
+
plugins = applicator.build_plugin_tarball do |mod|
|
87
|
+
next unless required_modules.nil? || required_modules.include?(mod.name)
|
88
|
+
search_dirs = []
|
89
|
+
search_dirs << mod.plugins if mod.plugins?
|
90
|
+
search_dirs << mod.pluginfacts if mod.pluginfacts?
|
91
|
+
search_dirs
|
92
|
+
end
|
93
|
+
|
75
94
|
executor.log_action('install puppet and gather facts', targets) do
|
76
95
|
executor.without_default_logging do
|
77
96
|
# Skip targets that include the puppet-agent feature, as we know an agent will be available.
|
@@ -109,14 +128,6 @@ Puppet::Functions.create_function(:apply_prep) do
|
|
109
128
|
need_install_targets.each { |target| set_agent_feature(target) }
|
110
129
|
end
|
111
130
|
|
112
|
-
# Gather facts, including custom facts
|
113
|
-
plugins = applicator.build_plugin_tarball do |mod|
|
114
|
-
search_dirs = []
|
115
|
-
search_dirs << mod.plugins if mod.plugins?
|
116
|
-
search_dirs << mod.pluginfacts if mod.pluginfacts?
|
117
|
-
search_dirs
|
118
|
-
end
|
119
|
-
|
120
131
|
task = applicator.custom_facts_task
|
121
132
|
arguments = { 'plugins' => Puppet::Pops::Types::PSensitiveType::Sensitive.new(plugins) }
|
122
133
|
results = executor.run_task(targets, task, arguments)
|
@@ -0,0 +1,123 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'pathname'
|
4
|
+
require 'bolt/error'
|
5
|
+
|
6
|
+
# Downloads the given file or directory from the given set of targets and saves it to a directory
|
7
|
+
# matching the target's name under the given destination directory. Returns the result from each
|
8
|
+
# download. This does nothing if the list of targets is empty.
|
9
|
+
#
|
10
|
+
# > **Note:** Existing content in the destination directory is deleted before downloading from
|
11
|
+
# > the targets.
|
12
|
+
#
|
13
|
+
# > **Note:** Not available in apply block
|
14
|
+
Puppet::Functions.create_function(:download_file, Puppet::Functions::InternalFunction) do
|
15
|
+
# Download a file or directory.
|
16
|
+
# @param source The absolute path to the file or directory on the target(s).
|
17
|
+
# @param destination The relative path to the destination directory on the local system. Expands
|
18
|
+
# relative to `<project>/downloads/`.
|
19
|
+
# @param targets A pattern identifying zero or more targets. See {get_targets} for accepted patterns.
|
20
|
+
# @param options A hash of additional options.
|
21
|
+
# @option options [Boolean] _catch_errors Whether to catch raised errors.
|
22
|
+
# @option options [String] _run_as User to run as using privilege escalation.
|
23
|
+
# @return A list of results, one entry per target, with the path to the downloaded file under the
|
24
|
+
# `path` key.
|
25
|
+
# @example Download a file from multiple Linux targets to a destination directory
|
26
|
+
# download_file('/etc/ssh/ssh_config', '~/Downloads', $targets)
|
27
|
+
# @example Download a directory from multiple Linux targets to a project downloads directory
|
28
|
+
# download_file('/etc/ssh', 'ssh', $targets)
|
29
|
+
# @example Download a file from multiple Linux targets and compare its contents to a local file
|
30
|
+
# $results = download_file($source, $destination, $targets)
|
31
|
+
#
|
32
|
+
# $local_content = file::read($source)
|
33
|
+
#
|
34
|
+
# $mismatched_files = $results.filter |$result| {
|
35
|
+
# $remote_content = file::read($result['path'])
|
36
|
+
# $remote_content == $local_content
|
37
|
+
# }
|
38
|
+
dispatch :download_file do
|
39
|
+
param 'String[1]', :source
|
40
|
+
param 'String[1]', :destination
|
41
|
+
param 'Boltlib::TargetSpec', :targets
|
42
|
+
optional_param 'Hash[String[1], Any]', :options
|
43
|
+
return_type 'ResultSet'
|
44
|
+
end
|
45
|
+
|
46
|
+
# Download a file or directory, logging the provided description.
|
47
|
+
# @param source The absolute path to the file or directory on the target(s).
|
48
|
+
# @param destination The relative path to the destination directory on the local system. Expands
|
49
|
+
# relative to `<project>/downloads/`.
|
50
|
+
# @param targets A pattern identifying zero or more targets. See {get_targets} for accepted patterns.
|
51
|
+
# @param description A description to be output when calling this function.
|
52
|
+
# @param options A hash of additional options.
|
53
|
+
# @option options [Boolean] _catch_errors Whether to catch raised errors.
|
54
|
+
# @option options [String] _run_as User to run as using privilege escalation.
|
55
|
+
# @return A list of results, one entry per target, with the path to the downloaded file under the
|
56
|
+
# `path` key.
|
57
|
+
# @example Download a file from multiple Linux targets to a destination directory
|
58
|
+
# download_file('/etc/ssh/ssh_config', '~/Downloads', $targets, 'Downloading remote SSH config')
|
59
|
+
dispatch :download_file_with_description do
|
60
|
+
param 'String[1]', :source
|
61
|
+
param 'String[1]', :destination
|
62
|
+
param 'Boltlib::TargetSpec', :targets
|
63
|
+
param 'String', :description
|
64
|
+
optional_param 'Hash[String[1], Any]', :options
|
65
|
+
return_type 'ResultSet'
|
66
|
+
end
|
67
|
+
|
68
|
+
def download_file(source, destination, targets, options = {})
|
69
|
+
download_file_with_description(source, destination, targets, nil, options)
|
70
|
+
end
|
71
|
+
|
72
|
+
def download_file_with_description(source, destination, targets, description = nil, options = {})
|
73
|
+
unless Puppet[:tasks]
|
74
|
+
raise Puppet::ParseErrorWithIssue
|
75
|
+
.from_issue_and_stack(Bolt::PAL::Issues::PLAN_OPERATION_NOT_SUPPORTED_WHEN_COMPILING, action: 'download_file')
|
76
|
+
end
|
77
|
+
|
78
|
+
options = options.select { |opt| opt.start_with?('_') }.transform_keys { |k| k.sub(/^_/, '').to_sym }
|
79
|
+
options[:description] = description if description
|
80
|
+
|
81
|
+
executor = Puppet.lookup(:bolt_executor)
|
82
|
+
inventory = Puppet.lookup(:bolt_inventory)
|
83
|
+
|
84
|
+
if (destination = destination.strip).empty?
|
85
|
+
raise Bolt::ValidationError, "Destination cannot be an empty string"
|
86
|
+
end
|
87
|
+
|
88
|
+
if (destination = Pathname.new(destination)).absolute?
|
89
|
+
raise Bolt::ValidationError, "Destination must be a relative path, received absolute path #{destination}"
|
90
|
+
end
|
91
|
+
|
92
|
+
# Prevent path traversal so downloads can't be saved outside of the project downloads directory
|
93
|
+
if (destination.each_filename.to_a & %w[. ..]).any?
|
94
|
+
raise Bolt::ValidationError, "Destination must not include path traversal, received #{destination}"
|
95
|
+
end
|
96
|
+
|
97
|
+
# Paths expand relative to the default downloads directory for the project
|
98
|
+
# e.g. ~/.puppetlabs/bolt/downloads/
|
99
|
+
destination = Puppet.lookup(:bolt_project_data).downloads + destination
|
100
|
+
|
101
|
+
# If the destination directory already exists, delete any existing contents
|
102
|
+
if Dir.exist?(destination)
|
103
|
+
FileUtils.rm_r(Dir.glob(destination + '*'), secure: true)
|
104
|
+
end
|
105
|
+
|
106
|
+
# Send Analytics Report
|
107
|
+
executor.report_function_call(self.class.name)
|
108
|
+
|
109
|
+
# Ensure that that given targets are all Target instances
|
110
|
+
targets = inventory.get_targets(targets)
|
111
|
+
if targets.empty?
|
112
|
+
call_function('debug', "Simulating file download of '#{source}' - no targets given - no action taken")
|
113
|
+
r = Bolt::ResultSet.new([])
|
114
|
+
else
|
115
|
+
r = executor.download_file(targets, source, destination, options)
|
116
|
+
end
|
117
|
+
|
118
|
+
if !r.ok && !options[:catch_errors]
|
119
|
+
raise Bolt::RunFailure.new(r, 'download_file', source)
|
120
|
+
end
|
121
|
+
r
|
122
|
+
end
|
123
|
+
end
|
@@ -17,6 +17,7 @@ Puppet::Functions.create_function(:facts) do
|
|
17
17
|
inventory = Puppet.lookup(:bolt_inventory)
|
18
18
|
# Bolt executor not expected when invoked from apply block
|
19
19
|
executor = Puppet.lookup(:bolt_executor) { nil }
|
20
|
+
# Send Analytics Report
|
20
21
|
executor&.report_function_call(self.class.name)
|
21
22
|
|
22
23
|
inventory.facts(target)
|
@@ -40,6 +40,7 @@ Puppet::Functions.create_function(:fail_plan) do
|
|
40
40
|
end
|
41
41
|
|
42
42
|
executor = Puppet.lookup(:bolt_executor)
|
43
|
+
# Send Analytics Report
|
43
44
|
executor.report_function_call(self.class.name)
|
44
45
|
|
45
46
|
raise Bolt::PlanFailure.new(msg, kind || 'bolt/plan-failure', details, issue_code)
|
@@ -21,6 +21,7 @@ Puppet::Functions.create_function(:get_target) do
|
|
21
21
|
inventory = Puppet.lookup(:bolt_inventory)
|
22
22
|
# Bolt executor not expected when invoked from apply block
|
23
23
|
executor = Puppet.lookup(:bolt_executor) { nil }
|
24
|
+
# Send Analytics Report
|
24
25
|
executor&.report_function_call(self.class.name)
|
25
26
|
|
26
27
|
unless inventory.version > 1
|
@@ -27,6 +27,7 @@ Puppet::Functions.create_function(:get_targets) do
|
|
27
27
|
inventory = Puppet.lookup(:bolt_inventory)
|
28
28
|
# Bolt executor not expected when invoked from apply block
|
29
29
|
executor = Puppet.lookup(:bolt_executor) { nil }
|
30
|
+
# Send Analytics Report
|
30
31
|
executor&.report_function_call(self.class.name)
|
31
32
|
|
32
33
|
inventory.get_targets(names)
|
@@ -20,6 +20,7 @@ Puppet::Functions.create_function(:puppetdb_fact) do
|
|
20
20
|
puppetdb_client = Puppet.lookup(:bolt_pdb_client)
|
21
21
|
# Bolt executor not expected when invoked from apply block
|
22
22
|
executor = Puppet.lookup(:bolt_executor) { nil }
|
23
|
+
# Send Analytics Report
|
23
24
|
executor&.report_function_call(self.class.name)
|
24
25
|
|
25
26
|
puppetdb_client.facts_for_node(certnames)
|
@@ -22,6 +22,7 @@ Puppet::Functions.create_function(:puppetdb_query) do
|
|
22
22
|
puppetdb_client = Puppet.lookup(:bolt_pdb_client)
|
23
23
|
# Bolt executor not expected when invoked from apply block
|
24
24
|
executor = Puppet.lookup(:bolt_executor) { nil }
|
25
|
+
# Send Analytics Report
|
25
26
|
executor&.report_function_call(self.class.name)
|
26
27
|
|
27
28
|
puppetdb_client.make_query(query)
|
@@ -31,6 +31,7 @@ Puppet::Functions.create_function(:remove_from_group) do
|
|
31
31
|
|
32
32
|
inventory = Puppet.lookup(:bolt_inventory)
|
33
33
|
executor = Puppet.lookup(:bolt_executor)
|
34
|
+
# Send Analytics Report
|
34
35
|
executor.report_function_call(self.class.name)
|
35
36
|
|
36
37
|
inventory.remove_from_group(inventory.get_targets(target), group)
|
@@ -41,6 +41,7 @@ Puppet::Functions.create_function(:resource) do
|
|
41
41
|
def resource(target, type, title)
|
42
42
|
inventory = Puppet.lookup(:bolt_inventory)
|
43
43
|
executor = Puppet.lookup(:bolt_executor) { nil }
|
44
|
+
# Send Analytics Report
|
44
45
|
executor&.report_function_call(self.class.name)
|
45
46
|
|
46
47
|
inventory.resource(target, type, title)
|
@@ -13,6 +13,7 @@ Puppet::Functions.create_function(:run_command) do
|
|
13
13
|
# @param options A hash of additional options.
|
14
14
|
# @option options [Boolean] _catch_errors Whether to catch raised errors.
|
15
15
|
# @option options [String] _run_as User to run as using privilege escalation.
|
16
|
+
# @option options [Hash] _env_vars Map of environment variables to set
|
16
17
|
# @return A list of results, one entry per target.
|
17
18
|
# @example Run a command on targets
|
18
19
|
# run_command('hostname', $targets, '_catch_errors' => true)
|
@@ -30,6 +31,7 @@ Puppet::Functions.create_function(:run_command) do
|
|
30
31
|
# @param options A hash of additional options.
|
31
32
|
# @option options [Boolean] _catch_errors Whether to catch raised errors.
|
32
33
|
# @option options [String] _run_as User to run as using privilege escalation.
|
34
|
+
# @option options [Hash] _env_vars Map of environment variables to set
|
33
35
|
# @return A list of results, one entry per target.
|
34
36
|
# @example Run a command on targets
|
35
37
|
# run_command('hostname', $targets, 'Get hostname')
|
@@ -57,6 +59,7 @@ Puppet::Functions.create_function(:run_command) do
|
|
57
59
|
executor = Puppet.lookup(:bolt_executor)
|
58
60
|
inventory = Puppet.lookup(:bolt_inventory)
|
59
61
|
|
62
|
+
# Send Analytics Report
|
60
63
|
executor.report_function_call(self.class.name)
|
61
64
|
|
62
65
|
# Ensure that given targets are all Target instances
|
@@ -64,10 +64,11 @@ Puppet::Functions.create_function(:run_plan, Puppet::Functions::InternalFunction
|
|
64
64
|
# Bolt calls this function internally to trigger plans from the CLI. We
|
65
65
|
# don't want to count those invocations.
|
66
66
|
unless options[:bolt_api_call]
|
67
|
+
# Send Analytics Report
|
67
68
|
executor.report_function_call(self.class.name)
|
68
69
|
end
|
69
70
|
|
70
|
-
# Report bundled content, this should capture plans run from both CLI and Plans
|
71
|
+
# Send Analytics Report for bundled content, this should capture plans run from both CLI and Plans
|
71
72
|
executor.report_bundled_content('Plan', plan_name)
|
72
73
|
|
73
74
|
loaders = closure_scope.compiler.loaders
|
@@ -11,8 +11,9 @@ Puppet::Functions.create_function(:run_script, Puppet::Functions::InternalFuncti
|
|
11
11
|
# @param targets A pattern identifying zero or more targets. See {get_targets} for accepted patterns.
|
12
12
|
# @param options A hash of additional options.
|
13
13
|
# @option options [Array[String]] arguments An array of arguments to be passed to the script.
|
14
|
-
# @option
|
15
|
-
# @option
|
14
|
+
# @option options [Boolean] _catch_errors Whether to catch raised errors.
|
15
|
+
# @option options [String] _run_as User to run as using privilege escalation.
|
16
|
+
# @option options [Hash] _env_vars Map of environment variables to set
|
16
17
|
# @return A list of results, one entry per target.
|
17
18
|
# @example Run a local script on Linux targets as 'root'
|
18
19
|
# run_script('/var/tmp/myscript', $targets, '_run_as' => 'root')
|
@@ -33,8 +34,9 @@ Puppet::Functions.create_function(:run_script, Puppet::Functions::InternalFuncti
|
|
33
34
|
# @param description A description to be output when calling this function.
|
34
35
|
# @param options A hash of additional options.
|
35
36
|
# @option options [Array[String]] arguments An array of arguments to be passed to the script.
|
36
|
-
# @option
|
37
|
-
# @option
|
37
|
+
# @option options [Boolean] _catch_errors Whether to catch raised errors.
|
38
|
+
# @option options [String] _run_as User to run as using privilege escalation.
|
39
|
+
# @option options [Hash] _env_vars Map of environment variables to set
|
38
40
|
# @return A list of results, one entry per target.
|
39
41
|
# @example Run a script
|
40
42
|
# run_script('/var/tmp/myscript', $targets, 'Downloading my application')
|
@@ -64,6 +66,7 @@ Puppet::Functions.create_function(:run_script, Puppet::Functions::InternalFuncti
|
|
64
66
|
executor = Puppet.lookup(:bolt_executor)
|
65
67
|
inventory = Puppet.lookup(:bolt_inventory)
|
66
68
|
|
69
|
+
# Send Analytics Report
|
67
70
|
executor.report_function_call(self.class.name)
|
68
71
|
|
69
72
|
found = Puppet::Parser::Files.find_file(script, scope.compiler.environment)
|
@@ -64,10 +64,11 @@ Puppet::Functions.create_function(:run_task) do
|
|
64
64
|
# Bolt calls this function internally to trigger tasks from the CLI. We
|
65
65
|
# don't want to count those invocations.
|
66
66
|
unless options[:bolt_api_call]
|
67
|
+
# Send Analytics Report
|
67
68
|
executor.report_function_call(self.class.name)
|
68
69
|
end
|
69
70
|
|
70
|
-
# Report bundled content, this should capture tasks run from both CLI and Plans
|
71
|
+
# Report Analytics for bundled content, this should capture tasks run from both CLI and Plans
|
71
72
|
executor.report_bundled_content('Task', task_name)
|
72
73
|
|
73
74
|
# Ensure that given targets are all Target instances
|
@@ -33,6 +33,7 @@ Puppet::Functions.create_function(:set_feature) do
|
|
33
33
|
|
34
34
|
inventory = Puppet.lookup(:bolt_inventory)
|
35
35
|
executor = Puppet.lookup(:bolt_executor)
|
36
|
+
# Send Analytics Report
|
36
37
|
executor.report_function_call(self.class.name)
|
37
38
|
|
38
39
|
inventory.set_feature(target, feature, value)
|
@@ -67,6 +67,7 @@ Puppet::Functions.create_function(:upload_file, Puppet::Functions::InternalFunct
|
|
67
67
|
executor = Puppet.lookup(:bolt_executor)
|
68
68
|
inventory = Puppet.lookup(:bolt_inventory)
|
69
69
|
|
70
|
+
# Send Analytics Report
|
70
71
|
executor.report_function_call(self.class.name)
|
71
72
|
|
72
73
|
found = Puppet::Parser::Files.find_file(source, scope.compiler.environment)
|
@@ -21,6 +21,7 @@ Puppet::Functions.create_function(:vars) do
|
|
21
21
|
inventory = Puppet.lookup(:bolt_inventory)
|
22
22
|
# Bolt executor not expected when invoked from apply block
|
23
23
|
executor = Puppet.lookup(:bolt_executor) { nil }
|
24
|
+
# Send Analytics Report
|
24
25
|
executor&.report_function_call(self.class.name)
|
25
26
|
|
26
27
|
inventory.vars(target)
|