bolt 2.1.0 → 2.2.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 +5 -5
- data/bolt-modules/boltlib/lib/puppet/functions/run_command.rb +1 -1
- data/bolt-modules/boltlib/lib/puppet/functions/run_plan.rb +1 -1
- data/bolt-modules/boltlib/lib/puppet/functions/run_script.rb +1 -1
- data/bolt-modules/boltlib/lib/puppet/functions/run_task.rb +1 -1
- data/bolt-modules/boltlib/lib/puppet/functions/upload_file.rb +1 -1
- data/lib/bolt/applicator.rb +2 -2
- data/lib/bolt/bolt_option_parser.rb +1 -1
- data/lib/bolt/cli.rb +1 -1
- data/lib/bolt/config.rb +201 -206
- data/lib/bolt/config/transport/base.rb +142 -0
- data/lib/bolt/config/transport/docker.rb +42 -0
- data/lib/bolt/config/transport/local.rb +73 -0
- data/lib/bolt/config/transport/orch.rb +47 -0
- data/lib/bolt/config/transport/remote.rb +25 -0
- data/lib/bolt/config/transport/ssh.rb +105 -0
- data/lib/bolt/config/transport/winrm.rb +80 -0
- data/lib/bolt/executor.rb +17 -0
- data/lib/bolt/inventory.rb +12 -5
- data/lib/bolt/inventory/group.rb +1 -1
- data/lib/bolt/inventory/inventory.rb +16 -22
- data/lib/bolt/inventory/target.rb +26 -29
- data/lib/bolt/plugin.rb +5 -5
- data/lib/bolt/plugin/module.rb +1 -1
- data/lib/bolt/plugin/pkcs7.rb +1 -1
- data/lib/bolt/result.rb +1 -1
- data/lib/bolt/target.rb +5 -2
- data/lib/bolt/transport/base.rb +0 -18
- data/lib/bolt/transport/docker.rb +0 -26
- data/lib/bolt/transport/local.rb +0 -30
- data/lib/bolt/transport/local_windows.rb +4 -36
- data/lib/bolt/transport/orch.rb +0 -20
- data/lib/bolt/transport/remote.rb +0 -20
- data/lib/bolt/transport/ssh.rb +0 -85
- data/lib/bolt/transport/sudoable.rb +0 -7
- data/lib/bolt/transport/winrm.rb +0 -66
- data/lib/bolt/util.rb +11 -0
- data/lib/bolt/version.rb +1 -1
- data/lib/bolt_server/transport_app.rb +1 -0
- data/lib/bolt_spec/plans.rb +1 -1
- data/lib/bolt_spec/plans/action_stubs/command_stub.rb +1 -1
- data/lib/bolt_spec/plans/action_stubs/script_stub.rb +1 -1
- data/lib/bolt_spec/plans/action_stubs/task_stub.rb +2 -2
- data/lib/bolt_spec/plans/action_stubs/upload_stub.rb +1 -1
- data/lib/bolt_spec/run.rb +1 -1
- data/libexec/apply_catalog.rb +1 -1
- data/libexec/custom_facts.rb +1 -1
- data/libexec/query_resources.rb +1 -1
- metadata +9 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7875970096b75c44b55dc718b1586f8b360e11041198893207c9c146649b89b7
|
4
|
+
data.tar.gz: f81ded40f2a72fd9e83b0f63f1ea0d7d4a5148589d1bdb65de82c023335ed611
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e4c8c1857380c9177284ce567228058f2bd516541020c7926ebc7ea3af23ab89525f5a3d146b3c40a62721e89401b960e3b7071b3473094caaed00b4225bbb3
|
7
|
+
data.tar.gz: a299f639f5e211c4cee1d3dbca7fb3a5ce4b5a770840c8a7e2da1f620a92b7045637113522fe6e0856fe70a7d3e286d5d5563fae6c53bfc852ec893e87250b86
|
data/Puppetfile
CHANGED
@@ -5,25 +5,25 @@ forge "http://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', '1.
|
8
|
+
mod 'puppetlabs-service', '1.2.0'
|
9
9
|
mod 'puppetlabs-puppet_agent', '3.0.2'
|
10
10
|
mod 'puppetlabs-facts', '1.0.0'
|
11
11
|
|
12
12
|
# Core types and providers for Puppet 6
|
13
13
|
mod 'puppetlabs-augeas_core', '1.0.5'
|
14
14
|
mod 'puppetlabs-host_core', '1.0.3'
|
15
|
-
mod 'puppetlabs-scheduled_task', '2.0.
|
15
|
+
mod 'puppetlabs-scheduled_task', '2.0.1'
|
16
16
|
mod 'puppetlabs-sshkeys_core', '1.0.3'
|
17
17
|
mod 'puppetlabs-zfs_core', '1.0.4'
|
18
18
|
mod 'puppetlabs-cron_core', '1.0.3'
|
19
19
|
mod 'puppetlabs-mount_core', '1.0.4'
|
20
20
|
mod 'puppetlabs-selinux_core', '1.0.4'
|
21
|
-
mod 'puppetlabs-yumrepo_core', '1.0.
|
21
|
+
mod 'puppetlabs-yumrepo_core', '1.0.6'
|
22
22
|
mod 'puppetlabs-zone_core', '1.0.3'
|
23
23
|
|
24
24
|
# Useful additional modules
|
25
|
-
mod 'puppetlabs-package', '
|
26
|
-
mod 'puppetlabs-puppet_conf', '0.
|
25
|
+
mod 'puppetlabs-package', '1.1.0'
|
26
|
+
mod 'puppetlabs-puppet_conf', '0.6.0'
|
27
27
|
mod 'puppetlabs-python_task_helper', '0.3.0'
|
28
28
|
mod 'puppetlabs-reboot', '3.0.0'
|
29
29
|
mod 'puppetlabs-ruby_task_helper', '0.4.0'
|
@@ -51,7 +51,7 @@ Puppet::Functions.create_function(:run_command) do
|
|
51
51
|
.from_issue_and_stack(Bolt::PAL::Issues::PLAN_OPERATION_NOT_SUPPORTED_WHEN_COMPILING, action: 'run_command')
|
52
52
|
end
|
53
53
|
|
54
|
-
options = options.
|
54
|
+
options = options.transform_keys { |k| k.sub(/^_/, '').to_sym }
|
55
55
|
options[:description] = description if description
|
56
56
|
|
57
57
|
executor = Puppet.lookup(:bolt_executor)
|
@@ -59,7 +59,7 @@ Puppet::Functions.create_function(:run_plan, Puppet::Functions::InternalFunction
|
|
59
59
|
executor = Puppet.lookup(:bolt_executor)
|
60
60
|
|
61
61
|
options, params = args.partition { |k, _v| k.start_with?('_') }.map(&:to_h)
|
62
|
-
options = options.
|
62
|
+
options = options.transform_keys { |k| k.sub(/^_/, '').to_sym }
|
63
63
|
|
64
64
|
# Bolt calls this function internally to trigger plans from the CLI. We
|
65
65
|
# don't want to count those invocations.
|
@@ -58,7 +58,7 @@ Puppet::Functions.create_function(:run_script, Puppet::Functions::InternalFuncti
|
|
58
58
|
end
|
59
59
|
|
60
60
|
arguments = options['arguments'] || []
|
61
|
-
options = options.select { |opt| opt.start_with?('_') }.
|
61
|
+
options = options.select { |opt| opt.start_with?('_') }.transform_keys { |k| k.sub(/^_/, '').to_sym }
|
62
62
|
options[:description] = description if description
|
63
63
|
|
64
64
|
executor = Puppet.lookup(:bolt_executor)
|
@@ -56,7 +56,7 @@ Puppet::Functions.create_function(:run_task) do
|
|
56
56
|
end
|
57
57
|
|
58
58
|
options, params = args.partition { |k, _v| k.start_with?('_') }.map(&:to_h)
|
59
|
-
options = options.
|
59
|
+
options = options.transform_keys { |k| k.sub(/^_/, '').to_sym }
|
60
60
|
|
61
61
|
executor = Puppet.lookup(:bolt_executor)
|
62
62
|
inventory = Puppet.lookup(:bolt_inventory)
|
@@ -61,7 +61,7 @@ Puppet::Functions.create_function(:upload_file, Puppet::Functions::InternalFunct
|
|
61
61
|
.from_issue_and_stack(Bolt::PAL::Issues::PLAN_OPERATION_NOT_SUPPORTED_WHEN_COMPILING, action: 'upload_file')
|
62
62
|
end
|
63
63
|
|
64
|
-
options = options.select { |opt| opt.start_with?('_') }.
|
64
|
+
options = options.select { |opt| opt.start_with?('_') }.transform_keys { |k| k.sub(/^_/, '').to_sym }
|
65
65
|
options[:description] = description if description
|
66
66
|
|
67
67
|
executor = Puppet.lookup(:bolt_executor)
|
data/lib/bolt/applicator.rb
CHANGED
@@ -151,7 +151,7 @@ module Bolt
|
|
151
151
|
if args.count > 1
|
152
152
|
type1 = Puppet.lookup(:pal_script_compiler).type('Hash[String, Data]')
|
153
153
|
Puppet::Pal.assert_type(type1, args[1], 'apply options')
|
154
|
-
options = args[1].
|
154
|
+
options = args[1].transform_keys { |k| k.sub(/^_/, '').to_sym }
|
155
155
|
end
|
156
156
|
|
157
157
|
plan_vars = scope.to_hash(true, true)
|
@@ -191,7 +191,7 @@ module Bolt
|
|
191
191
|
hiera_config: @hiera_config,
|
192
192
|
plan_vars: plan_vars,
|
193
193
|
# This data isn't available on the target config hash
|
194
|
-
config: @inventory.
|
194
|
+
config: @inventory.transport_data_get
|
195
195
|
}
|
196
196
|
|
197
197
|
description = options[:description] || 'apply catalog'
|
@@ -720,7 +720,7 @@ module Bolt
|
|
720
720
|
define('--puppetfile FILEPATH',
|
721
721
|
'Specify a Puppetfile to use when installing modules. (default: ~/.puppetlabs/bolt/Puppetfile)',
|
722
722
|
'Modules are installed in the current Boltdir.') do |path|
|
723
|
-
@options[:
|
723
|
+
@options[:puppetfile_path] = Pathname.new(File.expand_path(path))
|
724
724
|
end
|
725
725
|
define('--[no-]save-rerun', 'Whether to update the rerun file after this command.') do |save|
|
726
726
|
@options[:'save-rerun'] = save
|
data/lib/bolt/cli.rb
CHANGED
data/lib/bolt/config.rb
CHANGED
@@ -5,25 +5,16 @@ require 'logging'
|
|
5
5
|
require 'pathname'
|
6
6
|
require 'bolt/boltdir'
|
7
7
|
require 'bolt/logger'
|
8
|
-
require 'bolt/transport/ssh'
|
9
|
-
require 'bolt/transport/winrm'
|
10
|
-
require 'bolt/transport/orch'
|
11
|
-
require 'bolt/transport/local'
|
12
|
-
require 'bolt/transport/local_windows'
|
13
|
-
require 'bolt/transport/docker'
|
14
|
-
require 'bolt/transport/remote'
|
15
8
|
require 'bolt/util'
|
9
|
+
# Transport config objects
|
10
|
+
require 'bolt/config/transport/ssh'
|
11
|
+
require 'bolt/config/transport/winrm'
|
12
|
+
require 'bolt/config/transport/orch'
|
13
|
+
require 'bolt/config/transport/local'
|
14
|
+
require 'bolt/config/transport/docker'
|
15
|
+
require 'bolt/config/transport/remote'
|
16
16
|
|
17
17
|
module Bolt
|
18
|
-
TRANSPORTS = {
|
19
|
-
ssh: Bolt::Transport::SSH,
|
20
|
-
winrm: Bolt::Transport::WinRM,
|
21
|
-
pcp: Bolt::Transport::Orch,
|
22
|
-
local: Bolt::Util.windows? ? Bolt::Transport::LocalWindows : Bolt::Transport::Local,
|
23
|
-
docker: Bolt::Transport::Docker,
|
24
|
-
remote: Bolt::Transport::Remote
|
25
|
-
}.freeze
|
26
|
-
|
27
18
|
class UnknownTransportError < Bolt::Error
|
28
19
|
def initialize(transport, uri = nil)
|
29
20
|
msg = uri.nil? ? "Unknown transport #{transport}" : "Unknown transport #{transport} found for #{uri}"
|
@@ -32,12 +23,16 @@ module Bolt
|
|
32
23
|
end
|
33
24
|
|
34
25
|
class Config
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
26
|
+
attr_reader :config_files, :warnings, :data, :transports, :boltdir
|
27
|
+
|
28
|
+
TRANSPORT_CONFIG = {
|
29
|
+
'ssh' => Bolt::Config::Transport::SSH,
|
30
|
+
'winrm' => Bolt::Config::Transport::WinRM,
|
31
|
+
'pcp' => Bolt::Config::Transport::Orch,
|
32
|
+
'local' => Bolt::Config::Transport::Local,
|
33
|
+
'docker' => Bolt::Config::Transport::Docker,
|
34
|
+
'remote' => Bolt::Config::Transport::Remote
|
35
|
+
}.freeze
|
41
36
|
|
42
37
|
OPTIONS = {
|
43
38
|
"apply_settings" => "A map of Puppet settings to use when applying Puppet code",
|
@@ -154,52 +149,83 @@ module Bolt
|
|
154
149
|
end
|
155
150
|
|
156
151
|
@logger = Logging.logger[self]
|
157
|
-
|
158
|
-
@boltdir = boltdir
|
159
|
-
@concurrency = 100
|
160
|
-
@compile_concurrency = Etc.nprocessors
|
161
|
-
@transport = 'ssh'
|
162
|
-
@format = 'human'
|
163
|
-
@puppetdb = {}
|
164
|
-
@color = true
|
165
|
-
@save_rerun = true
|
166
|
-
@puppetfile_config = {}
|
167
|
-
@plugins = {}
|
168
|
-
@plugin_hooks = {}
|
169
|
-
@apply_settings = {}
|
170
152
|
@warnings = []
|
171
|
-
|
172
|
-
# add an entry for the default console logger
|
173
|
-
@log = { 'console' => {} }
|
174
|
-
|
153
|
+
@boltdir = boltdir
|
175
154
|
@transports = {}
|
155
|
+
@config_files = []
|
156
|
+
|
157
|
+
default_data = {
|
158
|
+
'apply_settings' => {},
|
159
|
+
'color' => true,
|
160
|
+
'compile-concurrency' => Etc.nprocessors,
|
161
|
+
'concurrency' => 100,
|
162
|
+
'format' => 'human',
|
163
|
+
'log' => { 'console' => {} },
|
164
|
+
'plugin_hooks' => {},
|
165
|
+
'plugins' => {},
|
166
|
+
'puppetdb' => {},
|
167
|
+
'puppetfile' => {},
|
168
|
+
'save-rerun' => true,
|
169
|
+
'transport' => 'ssh'
|
170
|
+
}
|
176
171
|
|
177
|
-
|
178
|
-
@
|
172
|
+
loaded_data = config_data.map do |config|
|
173
|
+
@config_files.push(config[:filepath])
|
174
|
+
config[:data]
|
179
175
|
end
|
180
176
|
|
181
|
-
|
182
|
-
config_data = merge_config_data(config_data)
|
183
|
-
update_from_file(config_data)
|
177
|
+
override_data = normalize_overrides(overrides)
|
184
178
|
|
185
|
-
|
179
|
+
@data = merge_config_layers(default_data, *loaded_data, override_data)
|
186
180
|
|
181
|
+
TRANSPORT_CONFIG.each do |transport, config|
|
182
|
+
@transports[transport] = config.new(@data.delete(transport), @boltdir.path)
|
183
|
+
end
|
184
|
+
|
185
|
+
finalize_data
|
187
186
|
validate
|
188
187
|
end
|
189
188
|
|
190
|
-
#
|
191
|
-
#
|
192
|
-
def
|
189
|
+
# Transforms CLI options into a config hash that can be merged with
|
190
|
+
# default and loaded config.
|
191
|
+
def normalize_overrides(options)
|
192
|
+
opts = options.transform_keys(&:to_s)
|
193
|
+
|
194
|
+
# Pull out config options
|
195
|
+
overrides = opts.slice(*OPTIONS.keys)
|
196
|
+
|
197
|
+
# Pull out transport config options
|
198
|
+
TRANSPORT_CONFIG.each do |transport, config|
|
199
|
+
overrides[transport] = opts.slice(*config.options.keys)
|
200
|
+
end
|
201
|
+
|
202
|
+
# Set console log to debug if in debug mode
|
203
|
+
if options[:debug]
|
204
|
+
overrides['log'] = { 'console' => { 'level' => :debug } }
|
205
|
+
end
|
206
|
+
|
207
|
+
if options[:puppetfile_path]
|
208
|
+
@puppetfile = options[:puppetfile_path]
|
209
|
+
end
|
210
|
+
|
211
|
+
overrides['trace'] = opts['trace'] if opts.key?('trace')
|
212
|
+
|
213
|
+
overrides
|
214
|
+
end
|
215
|
+
|
216
|
+
# Merge configuration from all sources into a single hash. Precedence from lowest to highest:
|
217
|
+
# defaults, system-wide, user-level, project-level, CLI overrides
|
218
|
+
def merge_config_layers(*config_data)
|
193
219
|
config_data.inject({}) do |acc, config|
|
194
|
-
acc.merge(config
|
220
|
+
acc.merge(config) do |key, val1, val2|
|
195
221
|
case key
|
196
222
|
# Plugin config is shallow merged for each plugin
|
197
223
|
when 'plugins'
|
198
224
|
val1.merge(val2) { |_, v1, v2| v1.merge(v2) }
|
199
225
|
# Transports are deep merged
|
200
|
-
when *
|
226
|
+
when *TRANSPORT_CONFIG.keys
|
201
227
|
Bolt::Util.deep_merge(val1, val2)
|
202
|
-
# Hash values are shallow
|
228
|
+
# Hash values are shallow merged
|
203
229
|
when 'puppetdb', 'plugin_hooks', 'apply_settings', 'log'
|
204
230
|
val1.merge(val2)
|
205
231
|
# All other values are overwritten
|
@@ -210,229 +236,198 @@ module Bolt
|
|
210
236
|
end
|
211
237
|
end
|
212
238
|
|
213
|
-
def overwrite_transport_data(transport, transports)
|
214
|
-
@transport = transport
|
215
|
-
@transports = transports
|
216
|
-
end
|
217
|
-
|
218
|
-
def transport_data_get
|
219
|
-
{ transport: @transport, transports: @transports }
|
220
|
-
end
|
221
|
-
|
222
239
|
def deep_clone
|
223
240
|
Bolt::Util.deep_clone(self)
|
224
241
|
end
|
225
242
|
|
226
|
-
def
|
227
|
-
|
228
|
-
|
229
|
-
'file:' + File.expand_path(target, @boltdir.path)
|
230
|
-
end
|
231
|
-
|
232
|
-
def update_logs(logs)
|
233
|
-
logs.each_pair do |k, v|
|
234
|
-
log_name = normalize_log(k)
|
235
|
-
@log[log_name] ||= {}
|
236
|
-
log = @log[log_name]
|
237
|
-
|
238
|
-
next unless v.is_a?(Hash)
|
239
|
-
|
240
|
-
if v.key?('level')
|
241
|
-
log[:level] = v['level'].to_s
|
242
|
-
end
|
243
|
-
|
244
|
-
if v.key?('append')
|
245
|
-
log[:append] = v['append']
|
246
|
-
end
|
247
|
-
end
|
248
|
-
end
|
249
|
-
|
250
|
-
def update_from_file(data)
|
251
|
-
if data['future']
|
252
|
-
msg = "Configuration option 'future' no longer exposes future behavior."
|
253
|
-
@warnings << { option: 'future', msg: msg }
|
254
|
-
end
|
255
|
-
|
256
|
-
if data['log'].is_a?(Hash)
|
257
|
-
update_logs(data['log'])
|
243
|
+
private def finalize_data
|
244
|
+
if @data['log'].is_a?(Hash)
|
245
|
+
@data['log'] = update_logs(@data['log'])
|
258
246
|
end
|
259
247
|
|
260
248
|
# Expand paths relative to the Boltdir. Any settings that came from the
|
261
249
|
# CLI will already be absolute, so the expand will be skipped.
|
262
|
-
if data.key?('modulepath')
|
250
|
+
if @data.key?('modulepath')
|
263
251
|
moduledirs = if data['modulepath'].is_a?(String)
|
264
252
|
data['modulepath'].split(File::PATH_SEPARATOR)
|
265
253
|
else
|
266
254
|
data['modulepath']
|
267
255
|
end
|
268
|
-
@modulepath = moduledirs.map do |moduledir|
|
256
|
+
@data['modulepath'] = moduledirs.map do |moduledir|
|
269
257
|
File.expand_path(moduledir, @boltdir.path)
|
270
258
|
end
|
271
259
|
end
|
272
260
|
|
273
|
-
|
274
|
-
|
275
|
-
if data.key?('puppetfile')
|
276
|
-
@puppetfile_config = data['puppetfile'].select { |k, _| PUPPETFILE_OPTIONS.include?(k) }
|
261
|
+
%w[hiera-config inventoryfile trusted-external-command].each do |opt|
|
262
|
+
@data[opt] = File.expand_path(@data[opt], @boltdir.path) if @data.key?(opt)
|
277
263
|
end
|
278
264
|
|
279
|
-
|
280
|
-
@
|
281
|
-
|
282
|
-
|
265
|
+
# Filter hashes to only include valid options
|
266
|
+
@data['apply_settings'] = @data['apply_settings'].slice(*APPLY_SETTINGS.keys)
|
267
|
+
@data['puppetfile'] = @data['puppetfile'].slice(*PUPPETFILE_OPTIONS.keys)
|
268
|
+
end
|
283
269
|
|
284
|
-
|
285
|
-
|
286
|
-
|
270
|
+
private def normalize_log(target)
|
271
|
+
return target if target == 'console'
|
272
|
+
target = target[5..-1] if target.start_with?('file:')
|
273
|
+
'file:' + File.expand_path(target, @boltdir.path)
|
274
|
+
end
|
287
275
|
|
288
|
-
|
276
|
+
private def update_logs(logs)
|
277
|
+
logs.each_with_object({}) do |(key, val), acc|
|
278
|
+
next unless val.is_a?(Hash)
|
289
279
|
|
290
|
-
|
280
|
+
name = normalize_log(key)
|
281
|
+
acc[name] = val.slice(*LOG_OPTIONS.keys)
|
282
|
+
.transform_keys(&:to_sym)
|
291
283
|
|
292
|
-
|
293
|
-
|
294
|
-
|
284
|
+
if (v = acc[name][:level])
|
285
|
+
unless v.is_a?(String) || v.is_a?(Symbol)
|
286
|
+
raise Bolt::ValidationError,
|
287
|
+
"level of log #{name} must be a String or Symbol, received #{v.class} #{v.inspect}"
|
288
|
+
end
|
289
|
+
unless Bolt::Logger.valid_level?(v)
|
290
|
+
raise Bolt::ValidationError,
|
291
|
+
"level of log #{name} must be one of #{Bolt::Logger.levels.join(', ')}; received #{v}"
|
292
|
+
end
|
293
|
+
end
|
295
294
|
|
296
|
-
|
295
|
+
if (v = acc[name][:append]) && v != true && v != false
|
296
|
+
raise Bolt::ValidationError,
|
297
|
+
"append flag of log #{name} must be a Boolean, received #{v.class} #{v.inspect}"
|
298
|
+
end
|
299
|
+
end
|
297
300
|
end
|
298
|
-
private :update_from_file
|
299
301
|
|
300
|
-
def
|
301
|
-
|
302
|
-
|
302
|
+
def validate
|
303
|
+
if @data['future']
|
304
|
+
msg = "Configuration option 'future' no longer exposes future behavior."
|
305
|
+
@warnings << { option: 'future', msg: msg }
|
303
306
|
end
|
304
307
|
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
308
|
+
keys = OPTIONS.keys - %w[plugins plugin_hooks]
|
309
|
+
keys.each do |key|
|
310
|
+
next unless Bolt::Util.references?(@data[key])
|
311
|
+
valid_keys = TRANSPORT_CONFIG.keys + %w[plugins plugin_hooks]
|
312
|
+
raise Bolt::ValidationError,
|
313
|
+
"Found unsupported key _plugin in config setting #{key}. Plugins are only available in "\
|
314
|
+
"#{valid_keys.join(', ')}."
|
311
315
|
end
|
312
316
|
|
313
|
-
|
317
|
+
unless concurrency.is_a?(Integer) && concurrency > 0
|
318
|
+
raise Bolt::ValidationError,
|
319
|
+
"Concurrency must be a positive Integer, received #{concurrency.class} #{concurrency}"
|
320
|
+
end
|
314
321
|
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
transport_options.each do |key|
|
320
|
-
if options[key]
|
321
|
-
transport[key.to_s] = Bolt::Util.walk_keys(options[key], &:to_s)
|
322
|
-
end
|
323
|
-
end
|
322
|
+
unless compile_concurrency.is_a?(Integer) && compile_concurrency > 0
|
323
|
+
raise Bolt::ValidationError,
|
324
|
+
"Compile concurrency must be a positive Integer, received #{compile_concurrency.class} "\
|
325
|
+
"#{compile_concurrency}"
|
324
326
|
end
|
325
327
|
|
326
|
-
|
327
|
-
|
328
|
+
compile_limit = 2 * Etc.nprocessors
|
329
|
+
unless compile_concurrency < compile_limit
|
330
|
+
raise Bolt::ValidationError, "Compilation is CPU-intensive, set concurrency less than #{compile_limit}"
|
328
331
|
end
|
329
332
|
|
330
|
-
|
331
|
-
|
333
|
+
unless %w[human json].include? format
|
334
|
+
raise Bolt::ValidationError, "Unsupported format: '#{format}'"
|
332
335
|
end
|
333
336
|
|
334
|
-
|
335
|
-
|
337
|
+
Bolt::Util.validate_file('hiera-config', @data['hiera_config']) if @data['hiera_config']
|
338
|
+
Bolt::Util.validate_file('trusted-external-command', trusted_external) if trusted_external
|
339
|
+
|
340
|
+
unless TRANSPORT_CONFIG.include?(transport)
|
341
|
+
raise UnknownTransportError, transport
|
336
342
|
end
|
337
343
|
end
|
338
344
|
|
339
|
-
def
|
340
|
-
|
345
|
+
def default_inventoryfile
|
346
|
+
@boltdir.inventory_file
|
341
347
|
end
|
342
348
|
|
343
|
-
def
|
344
|
-
|
345
|
-
@transport = data['transport'] if data.key?('transport')
|
349
|
+
def rerunfile
|
350
|
+
@boltdir.rerunfile
|
346
351
|
end
|
347
352
|
|
348
|
-
def
|
349
|
-
|
350
|
-
|
351
|
-
selected = impl.filter_options(data[key.to_s])
|
353
|
+
def hiera_config
|
354
|
+
@data['hiera-config'] || @boltdir.hiera_config
|
355
|
+
end
|
352
356
|
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
selected[opt] = File.expand_path(selected[opt], boltdir) if selected[opt].is_a?(String)
|
357
|
-
end
|
357
|
+
def puppetfile
|
358
|
+
@puppetfile || @boltdir.puppetfile
|
359
|
+
end
|
358
360
|
|
359
|
-
|
360
|
-
|
361
|
-
if existing[key]['interpreters']
|
362
|
-
existing[key]['interpreters'] = normalize_interpreters(existing[key]['interpreters'])
|
363
|
-
end
|
364
|
-
end
|
361
|
+
def modulepath
|
362
|
+
@data['modulepath'] || @boltdir.modulepath
|
365
363
|
end
|
366
364
|
|
367
|
-
def
|
368
|
-
|
369
|
-
key.chars[0] == '.' ? key : '.' + key
|
370
|
-
end
|
365
|
+
def modulepath=(value)
|
366
|
+
@data['modulepath'] = value
|
371
367
|
end
|
372
368
|
|
373
|
-
def
|
374
|
-
|
375
|
-
transports: @transports }
|
369
|
+
def concurrency
|
370
|
+
@data['concurrency']
|
376
371
|
end
|
377
372
|
|
378
|
-
def
|
379
|
-
@
|
373
|
+
def format
|
374
|
+
@data['format']
|
380
375
|
end
|
381
376
|
|
382
|
-
def
|
383
|
-
@
|
377
|
+
def format=(value)
|
378
|
+
@data['format'] = value
|
384
379
|
end
|
385
380
|
|
386
|
-
def
|
387
|
-
@
|
381
|
+
def trace
|
382
|
+
@data['trace']
|
388
383
|
end
|
389
384
|
|
390
|
-
def
|
391
|
-
@
|
385
|
+
def log
|
386
|
+
@data['log']
|
392
387
|
end
|
393
388
|
|
394
|
-
def
|
395
|
-
@
|
389
|
+
def puppetdb
|
390
|
+
@data['puppetdb']
|
396
391
|
end
|
397
392
|
|
398
|
-
def
|
399
|
-
@
|
400
|
-
|
401
|
-
raise Bolt::ValidationError,
|
402
|
-
"level of log #{name} must be one of: #{Bolt::Logger.levels.join(', ')}; received #{params[:level]}"
|
403
|
-
end
|
404
|
-
if params.key?(:append) && params[:append] != true && params[:append] != false
|
405
|
-
raise Bolt::ValidationError, "append flag of log #{name} must be a Boolean, received #{params[:append]}"
|
406
|
-
end
|
407
|
-
end
|
393
|
+
def color
|
394
|
+
@data['color']
|
395
|
+
end
|
408
396
|
|
409
|
-
|
410
|
-
|
411
|
-
|
397
|
+
def save_rerun
|
398
|
+
@data['save-rerun']
|
399
|
+
end
|
412
400
|
|
413
|
-
|
414
|
-
|
415
|
-
|
401
|
+
def inventoryfile
|
402
|
+
@data['inventoryfile']
|
403
|
+
end
|
416
404
|
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
end
|
405
|
+
def compile_concurrency
|
406
|
+
@data['compile-concurrency']
|
407
|
+
end
|
421
408
|
|
422
|
-
|
423
|
-
|
424
|
-
|
409
|
+
def puppetfile_config
|
410
|
+
@data['puppetfile']
|
411
|
+
end
|
412
|
+
|
413
|
+
def plugins
|
414
|
+
@data['plugins']
|
415
|
+
end
|
425
416
|
|
426
|
-
|
427
|
-
|
417
|
+
def plugin_hooks
|
418
|
+
@data['plugin_hooks']
|
419
|
+
end
|
428
420
|
|
429
|
-
|
430
|
-
|
431
|
-
|
421
|
+
def trusted_external
|
422
|
+
@data['trusted-external-command']
|
423
|
+
end
|
432
424
|
|
433
|
-
|
434
|
-
|
435
|
-
|
425
|
+
def apply_settings
|
426
|
+
@data['apply_settings']
|
427
|
+
end
|
428
|
+
|
429
|
+
def transport
|
430
|
+
@data['transport']
|
436
431
|
end
|
437
432
|
|
438
433
|
# Check if there is a case-insensitive match to the path
|
@@ -451,7 +446,7 @@ module Bolt
|
|
451
446
|
[*paths].map { |p| Dir.glob([p, casefold(p)]) }.flatten.uniq.reject { |p| [*paths].include?(p) }
|
452
447
|
end
|
453
448
|
|
454
|
-
def casefold(path)
|
449
|
+
private def casefold(path)
|
455
450
|
path.chars.map do |l|
|
456
451
|
l =~ /[A-Za-z]/ ? "[#{l.upcase}#{l.downcase}]" : l
|
457
452
|
end.join
|