bolt 3.8.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.
- checksums.yaml +4 -4
- data/bolt-modules/boltlib/lib/puppet/functions/apply_prep.rb +9 -6
- 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/lib/bolt/bolt_option_parser.rb +2 -2
- data/lib/bolt/cli.rb +0 -1
- data/lib/bolt/config/options.rb +2 -1
- data/lib/bolt/config/transport/options.rb +2 -1
- data/lib/bolt/logger.rb +1 -1
- data/lib/bolt/module_installer/specs.rb +1 -1
- data/lib/bolt/util.rb +13 -1
- data/lib/bolt/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f04dc4247f20f08ee8cfe33500b7ba9477963290ab5303b5f2c72ba60c529e1d
|
4
|
+
data.tar.gz: 4ebdf00f011c6d3de0e1b8e47f0763bfab04857fe4611391cf9bc800597c140e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5615936c79c5f157142e1703a83c9cf28e6ef2b91c090826130f57ac9dc636888847ddd87f01374053c768cf9d4e87a929f654126f6b37375ea1ae1cdc670530
|
7
|
+
data.tar.gz: 270c4669aff29a221c9a7711b7bac715bf6e821a01318f45866fdbadbf77e2e93424722db13b10812dc777d4dbc78c116be992f3a908365bc392820cbb6eeb0b
|
@@ -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
|
+
# @option options [String] _run_as User to run as using privilege escalation.
|
19
20
|
# @return [nil]
|
20
21
|
# @example Prepare targets by name.
|
21
22
|
# apply_prep('target1,target2')
|
@@ -71,7 +72,8 @@ Puppet::Functions.create_function(:apply_prep) do
|
|
71
72
|
.from_issue_and_stack(Bolt::PAL::Issues::PLAN_OPERATION_NOT_SUPPORTED_WHEN_COMPILING, action: 'apply_prep')
|
72
73
|
end
|
73
74
|
|
74
|
-
|
75
|
+
# Unfreeze this
|
76
|
+
options = options.slice(*%w[_run_as _required_modules])
|
75
77
|
|
76
78
|
applicator = Puppet.lookup(:apply_executor)
|
77
79
|
|
@@ -79,14 +81,14 @@ Puppet::Functions.create_function(:apply_prep) do
|
|
79
81
|
|
80
82
|
targets = inventory.get_targets(target_spec)
|
81
83
|
|
82
|
-
required_modules = options
|
83
|
-
if required_modules
|
84
|
+
required_modules = options.delete('_required_modules').to_a
|
85
|
+
if required_modules.any?
|
84
86
|
Puppet.debug("Syncing only required modules: #{required_modules.join(',')}.")
|
85
87
|
end
|
86
88
|
|
87
89
|
# Gather facts, including custom facts
|
88
90
|
plugins = applicator.build_plugin_tarball do |mod|
|
89
|
-
next unless required_modules.
|
91
|
+
next unless required_modules.empty? || required_modules.include?(mod.name)
|
90
92
|
search_dirs = []
|
91
93
|
search_dirs << mod.plugins if mod.plugins?
|
92
94
|
search_dirs << mod.pluginfacts if mod.pluginfacts?
|
@@ -107,8 +109,9 @@ Puppet::Functions.create_function(:apply_prep) do
|
|
107
109
|
opts = t.plugin_hooks&.fetch('puppet_library').dup
|
108
110
|
plugin_name = opts.delete('plugin')
|
109
111
|
hook = inventory.plugins.get_hook(plugin_name, :puppet_library)
|
112
|
+
# Give plan function options precedence over inventory options
|
110
113
|
{ 'target' => t,
|
111
|
-
'hook_proc' => hook.call(opts, t, self) }
|
114
|
+
'hook_proc' => hook.call(opts.merge(options), t, self) }
|
112
115
|
rescue StandardError => e
|
113
116
|
Bolt::Result.from_exception(t, e)
|
114
117
|
end
|
@@ -132,7 +135,7 @@ Puppet::Functions.create_function(:apply_prep) do
|
|
132
135
|
|
133
136
|
task = applicator.custom_facts_task
|
134
137
|
arguments = { 'plugins' => Puppet::Pops::Types::PSensitiveType::Sensitive.new(plugins) }
|
135
|
-
results =
|
138
|
+
results = run_task(targets, task, arguments, options)
|
136
139
|
|
137
140
|
# TODO: Standardize RunFailure type with error above
|
138
141
|
raise Bolt::RunFailure.new(results, 'run_task', task.name) unless results.ok?
|
@@ -21,7 +21,7 @@ Puppet::Functions.create_function(:'file::exists', Puppet::Functions::InternalFu
|
|
21
21
|
executor = Puppet.lookup(:bolt_executor) {}
|
22
22
|
executor&.report_function_call(self.class.name)
|
23
23
|
|
24
|
-
future = executor&.future || Puppet.lookup(:future)
|
24
|
+
future = executor&.future || Puppet.lookup(:future) { {} }
|
25
25
|
fallback = future.fetch('file_paths', false)
|
26
26
|
|
27
27
|
# Find the file path if it exists, otherwise return nil
|
@@ -20,7 +20,7 @@ Puppet::Functions.create_function(:'file::read', Puppet::Functions::InternalFunc
|
|
20
20
|
executor = Puppet.lookup(:bolt_executor) {}
|
21
21
|
executor&.report_function_call(self.class.name)
|
22
22
|
|
23
|
-
future = executor&.future || Puppet.lookup(:future)
|
23
|
+
future = executor&.future || Puppet.lookup(:future) { {} }
|
24
24
|
fallback = future.fetch('file_paths', false)
|
25
25
|
|
26
26
|
# Find the file path if it exists, otherwise return nil
|
@@ -21,7 +21,7 @@ Puppet::Functions.create_function(:'file::readable', Puppet::Functions::Internal
|
|
21
21
|
executor = Puppet.lookup(:bolt_executor) {}
|
22
22
|
executor&.report_function_call(self.class.name)
|
23
23
|
|
24
|
-
future = executor&.future || Puppet.lookup(:future)
|
24
|
+
future = executor&.future || Puppet.lookup(:future) { {} }
|
25
25
|
fallback = future.fetch('file_paths', false)
|
26
26
|
|
27
27
|
# Find the file path if it exists, otherwise return nil
|
@@ -996,8 +996,8 @@ module Bolt
|
|
996
996
|
separator "\n#{self.class.colorize(:cyan, 'Display options')}"
|
997
997
|
define('--filter FILTER', 'Filter tasks and plans by a matching substring.') do |filter|
|
998
998
|
unless /^[a-z0-9_:]+$/.match(filter)
|
999
|
-
msg = "Illegal characters in filter string '#{filter}'. Filters
|
1000
|
-
|
999
|
+
msg = "Illegal characters in filter string '#{filter}'. Filters can "\
|
1000
|
+
"only include lowercase letters, numbers, underscores, and colons."
|
1001
1001
|
raise Bolt::CLIError, msg
|
1002
1002
|
end
|
1003
1003
|
@options[:filter] = filter
|
data/lib/bolt/cli.rb
CHANGED
@@ -153,7 +153,6 @@ module Bolt
|
|
153
153
|
options[:subcommand] = nil unless COMMANDS.include?(options[:subcommand])
|
154
154
|
|
155
155
|
if Bolt::Util.first_run?
|
156
|
-
FileUtils.mkdir_p(Bolt::Util.first_runs_free.dirname)
|
157
156
|
FileUtils.touch(Bolt::Util.first_runs_free)
|
158
157
|
|
159
158
|
if options[:subcommand].nil? && $stdout.isatty
|
data/lib/bolt/config/options.rb
CHANGED
@@ -279,7 +279,8 @@ module Bolt
|
|
279
279
|
"modules" => {
|
280
280
|
description: "A list of module dependencies for the project. Each dependency is a map of data specifying "\
|
281
281
|
"the module to install. To install the project's module dependencies, run the `bolt module "\
|
282
|
-
"install` command."
|
282
|
+
"install` command. For more information about specifying modules, see [the "\
|
283
|
+
"documentation](https://pup.pt/bolt-module-specs).",
|
283
284
|
type: Array,
|
284
285
|
items: {
|
285
286
|
type: [Hash, String],
|
@@ -235,7 +235,8 @@ module Bolt
|
|
235
235
|
"private-key" => {
|
236
236
|
type: [Hash, String],
|
237
237
|
description: "Either the path to the private key file to use for authentication, or "\
|
238
|
-
|
238
|
+
"a hash with the key `key-data` and the contents of the private key. Note that "\
|
239
|
+
"the key cannot be encrypted if using the `key-data` hash.",
|
239
240
|
required: ["key-data"],
|
240
241
|
properties: {
|
241
242
|
"key-data" => {
|
data/lib/bolt/logger.rb
CHANGED
@@ -55,7 +55,7 @@ module Bolt
|
|
55
55
|
Invalid module specification:
|
56
56
|
#{hash.to_yaml.lines.drop(1).join.chomp}
|
57
57
|
|
58
|
-
To read more about specifying modules, see https://pup.pt/bolt-
|
58
|
+
To read more about specifying modules, see https://pup.pt/bolt-module-specs
|
59
59
|
MESSAGE
|
60
60
|
end
|
61
61
|
|
data/lib/bolt/util.rb
CHANGED
@@ -78,11 +78,23 @@ module Bolt
|
|
78
78
|
end
|
79
79
|
|
80
80
|
def first_runs_free
|
81
|
+
# If this fails, use the system path instead
|
82
|
+
FileUtils.mkdir_p(Bolt::Config.user_path)
|
81
83
|
Bolt::Config.user_path + '.first_runs_free'
|
84
|
+
rescue StandardError
|
85
|
+
begin
|
86
|
+
# If using the system path fails, then don't bother with the welcome
|
87
|
+
# message
|
88
|
+
FileUtils.mkdir_p(Bolt::Config.system_path)
|
89
|
+
Bolt::Config.system_path + '.first_runs_free'
|
90
|
+
rescue StandardError
|
91
|
+
nil
|
92
|
+
end
|
82
93
|
end
|
83
94
|
|
84
95
|
def first_run?
|
85
|
-
|
96
|
+
!first_runs_free.nil? &&
|
97
|
+
!File.exist?(first_runs_free)
|
86
98
|
end
|
87
99
|
|
88
100
|
# If Puppet is loaded, we aleady have the path to the module and should
|
data/lib/bolt/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bolt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.8.
|
4
|
+
version: 3.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-05-
|
11
|
+
date: 2021-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|