bolt 3.17.0 → 3.21.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 +14 -14
- data/bolt-modules/boltlib/lib/puppet/functions/run_script.rb +1 -4
- data/bolt-modules/boltlib/lib/puppet/functions/upload_file.rb +1 -4
- data/bolt-modules/file/lib/puppet/functions/file/exists.rb +1 -4
- data/bolt-modules/file/lib/puppet/functions/file/read.rb +1 -4
- data/bolt-modules/file/lib/puppet/functions/file/readable.rb +1 -4
- data/lib/bolt/analytics.rb +2 -2
- data/lib/bolt/application.rb +177 -12
- data/lib/bolt/applicator.rb +7 -6
- data/lib/bolt/apply_inventory.rb +3 -3
- data/lib/bolt/apply_result.rb +2 -2
- data/lib/bolt/bolt_option_parser.rb +87 -22
- data/lib/bolt/catalog.rb +10 -11
- data/lib/bolt/cli.rb +66 -24
- data/lib/bolt/config/modulepath.rb +1 -1
- data/lib/bolt/config/options.rb +42 -13
- data/lib/bolt/config/transport/base.rb +4 -4
- data/lib/bolt/config/transport/docker.rb +2 -2
- data/lib/bolt/config/transport/local.rb +2 -2
- data/lib/bolt/config/transport/lxd.rb +2 -2
- data/lib/bolt/config/transport/options.rb +3 -2
- data/lib/bolt/config/transport/orch.rb +2 -2
- data/lib/bolt/config/transport/podman.rb +2 -2
- data/lib/bolt/config/transport/remote.rb +2 -2
- data/lib/bolt/config/transport/ssh.rb +2 -2
- data/lib/bolt/config/transport/winrm.rb +2 -2
- data/lib/bolt/config.rb +9 -5
- data/lib/bolt/container_result.rb +2 -2
- data/lib/bolt/error.rb +1 -1
- data/lib/bolt/executor.rb +17 -14
- data/lib/bolt/fiber_executor.rb +2 -2
- data/lib/bolt/inventory/group.rb +4 -4
- data/lib/bolt/inventory/inventory.rb +3 -9
- data/lib/bolt/inventory/options.rb +1 -1
- data/lib/bolt/inventory/target.rb +1 -1
- data/lib/bolt/inventory.rb +8 -8
- data/lib/bolt/module_installer/installer.rb +2 -2
- data/lib/bolt/module_installer/puppetfile/forge_module.rb +1 -1
- data/lib/bolt/module_installer/puppetfile/git_module.rb +1 -1
- data/lib/bolt/module_installer/puppetfile/module.rb +1 -1
- data/lib/bolt/module_installer/puppetfile.rb +3 -3
- data/lib/bolt/module_installer/resolver.rb +3 -3
- data/lib/bolt/module_installer/specs/forge_spec.rb +1 -1
- data/lib/bolt/module_installer/specs/git_spec.rb +1 -1
- data/lib/bolt/module_installer/specs.rb +3 -3
- data/lib/bolt/module_installer.rb +6 -6
- data/lib/bolt/node/errors.rb +1 -1
- data/lib/bolt/node/output.rb +1 -1
- data/lib/bolt/outputter/human.rb +45 -2
- data/lib/bolt/outputter/json.rb +8 -0
- data/lib/bolt/outputter/logger.rb +1 -1
- data/lib/bolt/outputter/rainbow.rb +1 -1
- data/lib/bolt/outputter.rb +4 -4
- data/lib/bolt/pal/logging.rb +1 -1
- data/lib/bolt/pal/yaml_plan/evaluator.rb +1 -1
- data/lib/bolt/pal/yaml_plan/loader.rb +2 -2
- data/lib/bolt/pal/yaml_plan/step.rb +11 -11
- data/lib/bolt/pal/yaml_plan/transpiler.rb +3 -3
- data/lib/bolt/pal/yaml_plan.rb +2 -2
- data/lib/bolt/pal.rb +25 -11
- data/lib/bolt/plan_creator.rb +4 -4
- data/lib/bolt/plan_result.rb +2 -2
- data/lib/bolt/plugin/cache.rb +2 -2
- data/lib/bolt/plugin/module.rb +1 -1
- data/lib/bolt/plugin.rb +7 -7
- data/lib/bolt/project.rb +7 -5
- data/lib/bolt/project_manager/config_migrator.rb +1 -1
- data/lib/bolt/project_manager/inventory_migrator.rb +1 -1
- data/lib/bolt/project_manager/migrator.rb +1 -1
- data/lib/bolt/project_manager/module_migrator.rb +5 -5
- data/lib/bolt/project_manager.rb +23 -4
- data/lib/bolt/puppetdb/config.rb +1 -1
- data/lib/bolt/puppetdb.rb +3 -3
- data/lib/bolt/result.rb +1 -1
- data/lib/bolt/shell/bash.rb +14 -8
- data/lib/bolt/shell/powershell.rb +23 -4
- data/lib/bolt/shell.rb +2 -2
- data/lib/bolt/target.rb +2 -2
- data/lib/bolt/transport/base.rb +1 -1
- data/lib/bolt/transport/docker/connection.rb +1 -1
- data/lib/bolt/transport/docker.rb +2 -2
- data/lib/bolt/transport/local/connection.rb +2 -2
- data/lib/bolt/transport/local.rb +3 -3
- data/lib/bolt/transport/lxd/connection.rb +1 -1
- data/lib/bolt/transport/lxd.rb +4 -4
- data/lib/bolt/transport/orch.rb +2 -2
- data/lib/bolt/transport/podman/connection.rb +1 -1
- data/lib/bolt/transport/podman.rb +2 -2
- data/lib/bolt/transport/remote.rb +2 -2
- data/lib/bolt/transport/simple.rb +3 -3
- data/lib/bolt/transport/ssh/connection.rb +3 -3
- data/lib/bolt/transport/ssh.rb +5 -5
- data/lib/bolt/transport/winrm/connection.rb +2 -2
- data/lib/bolt/transport/winrm.rb +3 -3
- data/lib/bolt/util.rb +11 -31
- data/lib/bolt/validator.rb +1 -1
- data/lib/bolt/version.rb +1 -1
- data/lib/bolt.rb +1 -1
- data/lib/bolt_server/transport_app.rb +26 -5
- data/lib/bolt_spec/bolt_context.rb +6 -4
- data/lib/bolt_spec/plans/mock_executor.rb +3 -3
- data/libexec/bolt_catalog +1 -1
- metadata +6 -6
data/lib/bolt.rb
CHANGED
@@ -184,6 +184,7 @@ module BoltServer
|
|
184
184
|
search_dirs << mod.pluginfacts if mod.pluginfacts?
|
185
185
|
if tarball_type == 'all_plugins'
|
186
186
|
search_dirs << mod.files if mod.files?
|
187
|
+
search_dirs << mod.scripts if mod.scripts?
|
187
188
|
type_files = "#{mod.path}/types"
|
188
189
|
search_dirs << type_files if File.exist?(type_files)
|
189
190
|
end
|
@@ -413,6 +414,8 @@ module BoltServer
|
|
413
414
|
'path' => case mount_segment
|
414
415
|
when 'files'
|
415
416
|
"/puppet/v3/file_content/modules/#{module_segment}/#{name_segment}"
|
417
|
+
when 'scripts'
|
418
|
+
"/puppet/v3/file_content/scripts/#{module_segment}/#{name_segment}"
|
416
419
|
when 'tasks'
|
417
420
|
"/puppet/v3/file_content/tasks/#{module_segment}/#{name_segment}"
|
418
421
|
when 'lib'
|
@@ -462,28 +465,46 @@ module BoltServer
|
|
462
465
|
end
|
463
466
|
|
464
467
|
def file_metadatas(versioned_project, module_name, file)
|
465
|
-
|
468
|
+
result = @pal_mutex.synchronize do
|
466
469
|
bolt_config = config_from_project(versioned_project)
|
467
470
|
pal = pal_from_project_bolt_config(bolt_config)
|
468
471
|
pal.in_bolt_compiler do
|
469
472
|
mod = Puppet.lookup(:current_environment).module(module_name)
|
470
473
|
raise BoltServer::RequestError, "module_name: '#{module_name}' does not exist" unless mod
|
471
|
-
|
474
|
+
# First, look in the 'old' location <module>/files/<path>.
|
475
|
+
# If not found, and the path starts with `files` or `scripts`, munge
|
476
|
+
# the path and look inside that directory.
|
477
|
+
if (abs_path = mod.file(file))
|
478
|
+
{ abs_file_path: abs_path, puppetserver_root: "modules/#{module_name}/#{file}" }
|
479
|
+
else
|
480
|
+
subdir, relative_path = file.split(File::SEPARATOR, 2)
|
481
|
+
abs_path, mount = case subdir
|
482
|
+
when 'files'
|
483
|
+
[mod.file(relative_path), 'modules']
|
484
|
+
when 'scripts'
|
485
|
+
[mod.script(relative_path), 'scripts']
|
486
|
+
end
|
487
|
+
next nil unless abs_path
|
488
|
+
{ abs_file_path: abs_path, puppetserver_root: "#{mount}/#{module_name}/#{relative_path}" }
|
489
|
+
end
|
472
490
|
end
|
473
491
|
end
|
474
492
|
|
475
|
-
unless
|
493
|
+
unless result
|
476
494
|
raise BoltServer::RequestError,
|
477
|
-
"file: '#{file}' does not exist inside
|
495
|
+
"file: '#{file}' does not exist inside #{module_name} 'files' or 'scripts' directories"
|
478
496
|
end
|
479
497
|
|
498
|
+
abs_file_path = result[:abs_file_path]
|
499
|
+
puppetserver_root = result[:puppetserver_root]
|
500
|
+
|
480
501
|
fileset = Puppet::FileServing::Fileset.new(abs_file_path, 'recurse' => 'yes')
|
481
502
|
Puppet::FileServing::Fileset.merge(fileset).collect do |relative_file_path, base_path|
|
482
503
|
metadata = Puppet::FileServing::Metadata.new(base_path, relative_path: relative_file_path)
|
483
504
|
metadata.checksum_type = 'sha256'
|
484
505
|
metadata.links = 'follow'
|
485
506
|
metadata.collect
|
486
|
-
metadata.to_data_hash
|
507
|
+
metadata.to_data_hash.merge(puppetserver_root: puppetserver_root)
|
487
508
|
end
|
488
509
|
end
|
489
510
|
|
@@ -39,13 +39,15 @@ require 'bolt/plugin'
|
|
39
39
|
#
|
40
40
|
# Stubs:
|
41
41
|
# - allow_command(cmd), expect_command(cmd): expect the exact command
|
42
|
-
# - allow_script(script), expect_script(script): expect the script as <module>/path/to/file
|
42
|
+
# - allow_script(script), expect_script(script): expect the script as <module>/path/to/file or an absolute path
|
43
43
|
# - allow_task(task), expect_task(task): expect the named task
|
44
44
|
# - allow_download(file), expect_download(file): expect the identified source file
|
45
|
-
# - allow_upload(file), expect_upload(file): expect the
|
45
|
+
# - allow_upload(file), expect_upload(file): expect the source file as <module>/path/to/file or an absolute path
|
46
46
|
# - allow_out_message, expect_out_message: expect a message to be passed to out::message (only modifiers are
|
47
47
|
# be_called_times(n), with_params(params), and not_be_called)
|
48
48
|
#
|
49
|
+
# Files with absolute path (for upload and script) must exist or those functions will fail.
|
50
|
+
#
|
49
51
|
# Stub modifiers:
|
50
52
|
# - be_called_times(n): if allowed, fail if the action is called more than 'n' times
|
51
53
|
# if expected, fail unless the action is called 'n' times
|
@@ -211,8 +213,8 @@ module BoltSpec
|
|
211
213
|
# def allow_script(script_name)
|
212
214
|
#
|
213
215
|
# file uploads and downloads have a single destination and no arguments
|
214
|
-
# def
|
215
|
-
# def
|
216
|
+
# def allow_upload(source_name)
|
217
|
+
# def allow_download(source_name)
|
216
218
|
#
|
217
219
|
# Most of the information in commands is in the command string itself
|
218
220
|
# we may need more flexible allows than just the name/command string
|
@@ -44,7 +44,7 @@ module BoltSpec
|
|
44
44
|
|
45
45
|
def module_file_id(file)
|
46
46
|
modpath = @modulepath.select { |path| file =~ /^#{path}/ }
|
47
|
-
|
47
|
+
return nil unless modpath.size == 1
|
48
48
|
|
49
49
|
path = Pathname.new(file)
|
50
50
|
relative = path.relative_path_from(Pathname.new(modpath.first))
|
@@ -66,7 +66,7 @@ module BoltSpec
|
|
66
66
|
end
|
67
67
|
|
68
68
|
def run_script(targets, script_path, arguments, options = {}, _position = [])
|
69
|
-
script = module_file_id(script_path)
|
69
|
+
script = module_file_id(script_path) || script_path
|
70
70
|
result = nil
|
71
71
|
if (doub = @script_doubles[script] || @script_doubles[:default])
|
72
72
|
result = doub.process(targets, script, arguments, options)
|
@@ -116,7 +116,7 @@ module BoltSpec
|
|
116
116
|
end
|
117
117
|
|
118
118
|
def upload_file(targets, source_path, destination, options = {}, _position = [])
|
119
|
-
source = module_file_id(source_path)
|
119
|
+
source = module_file_id(source_path) || source_path
|
120
120
|
result = nil
|
121
121
|
if (doub = @upload_doubles[source] || @upload_doubles[:default])
|
122
122
|
result = doub.process(targets, source, destination, options)
|
data/libexec/bolt_catalog
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.
|
4
|
+
version: 3.21.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -260,14 +260,14 @@ dependencies:
|
|
260
260
|
requirements:
|
261
261
|
- - "~>"
|
262
262
|
- !ruby/object:Gem::Version
|
263
|
-
version: '3.
|
263
|
+
version: '3.10'
|
264
264
|
type: :runtime
|
265
265
|
prerelease: false
|
266
266
|
version_requirements: !ruby/object:Gem::Requirement
|
267
267
|
requirements:
|
268
268
|
- - "~>"
|
269
269
|
- !ruby/object:Gem::Version
|
270
|
-
version: '3.
|
270
|
+
version: '3.10'
|
271
271
|
- !ruby/object:Gem::Dependency
|
272
272
|
name: ruby_smb
|
273
273
|
requirement: !ruby/object:Gem::Requirement
|
@@ -288,14 +288,14 @@ dependencies:
|
|
288
288
|
requirements:
|
289
289
|
- - "~>"
|
290
290
|
- !ruby/object:Gem::Version
|
291
|
-
version: '
|
291
|
+
version: '3.0'
|
292
292
|
type: :runtime
|
293
293
|
prerelease: false
|
294
294
|
version_requirements: !ruby/object:Gem::Requirement
|
295
295
|
requirements:
|
296
296
|
- - "~>"
|
297
297
|
- !ruby/object:Gem::Version
|
298
|
-
version: '
|
298
|
+
version: '3.0'
|
299
299
|
- !ruby/object:Gem::Dependency
|
300
300
|
name: winrm
|
301
301
|
requirement: !ruby/object:Gem::Requirement
|