bolt 3.17.0 → 3.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Puppetfile +6 -6
- 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 +5 -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/catalog.rb +10 -11
- data/lib/bolt/cli.rb +18 -19
- data/lib/bolt/config/modulepath.rb +1 -1
- data/lib/bolt/config/options.rb +32 -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/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 +5 -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 +2 -8
- 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 +2 -2
- 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 +11 -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 +4 -4
- 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 +12 -2
- data/lib/bolt/shell/powershell.rb +9 -2
- 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 +8 -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 +16 -2
- 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 +4 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
require_relative 'powershell/snippets'
|
|
4
4
|
|
|
5
5
|
module Bolt
|
|
6
6
|
class Shell
|
|
@@ -212,7 +212,14 @@ module Bolt
|
|
|
212
212
|
elsif powershell_file?(script_path)
|
|
213
213
|
Snippets.run_script(arguments, script_path)
|
|
214
214
|
else
|
|
215
|
-
|
|
215
|
+
interpreter = select_interpreter(script_path, target.options['interpreters'])
|
|
216
|
+
if options[:script_interpreter] && interpreter
|
|
217
|
+
path = interpreter
|
|
218
|
+
args = escape_arguments([script_path])
|
|
219
|
+
logger.trace("Running '#{script_path}' using '#{interpreter}' interpreter")
|
|
220
|
+
else
|
|
221
|
+
path, args = *process_from_extension(script_path)
|
|
222
|
+
end
|
|
216
223
|
args += escape_arguments(arguments)
|
|
217
224
|
execute_process(path, args)
|
|
218
225
|
end
|
data/lib/bolt/shell.rb
CHANGED
data/lib/bolt/target.rb
CHANGED
data/lib/bolt/transport/base.rb
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require 'json'
|
|
4
4
|
require 'shellwords'
|
|
5
|
-
|
|
5
|
+
require_relative '../../bolt/transport/simple'
|
|
6
6
|
|
|
7
7
|
module Bolt
|
|
8
8
|
module Transport
|
|
@@ -20,4 +20,4 @@ module Bolt
|
|
|
20
20
|
end
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
require_relative 'docker/connection'
|
data/lib/bolt/transport/local.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
require_relative '../../bolt/logger'
|
|
4
|
+
require_relative '../../bolt/transport/simple'
|
|
5
5
|
|
|
6
6
|
module Bolt
|
|
7
7
|
module Transport
|
|
@@ -21,4 +21,4 @@ module Bolt
|
|
|
21
21
|
end
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
require_relative 'local/connection'
|
data/lib/bolt/transport/lxd.rb
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
require_relative '../../bolt/logger'
|
|
4
|
+
require_relative '../../bolt/node/errors'
|
|
5
|
+
require_relative '../../bolt/transport/simple'
|
|
6
6
|
|
|
7
7
|
module Bolt
|
|
8
8
|
module Transport
|
|
@@ -23,4 +23,4 @@ module Bolt
|
|
|
23
23
|
end
|
|
24
24
|
end
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
require_relative 'lxd/connection'
|
data/lib/bolt/transport/orch.rb
CHANGED
|
@@ -4,8 +4,8 @@ require 'base64'
|
|
|
4
4
|
require 'find'
|
|
5
5
|
require 'json'
|
|
6
6
|
require 'pathname'
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
require_relative '../../bolt/transport/base'
|
|
8
|
+
require_relative 'orch/connection'
|
|
9
9
|
|
|
10
10
|
module Bolt
|
|
11
11
|
module Transport
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require 'json'
|
|
4
4
|
require 'shellwords'
|
|
5
|
-
|
|
5
|
+
require_relative '../../bolt/transport/base'
|
|
6
6
|
|
|
7
7
|
module Bolt
|
|
8
8
|
module Transport
|
|
@@ -16,4 +16,4 @@ module Bolt
|
|
|
16
16
|
end
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
require_relative 'podman/connection'
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require 'logging'
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
require_relative '../../bolt/result'
|
|
5
|
+
require_relative '../../bolt/shell'
|
|
6
|
+
require_relative '../../bolt/transport/base'
|
|
7
7
|
|
|
8
8
|
module Bolt
|
|
9
9
|
module Transport
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
require 'logging'
|
|
4
4
|
require 'shellwords'
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
require_relative '../../../bolt/node/errors'
|
|
6
|
+
require_relative '../../../bolt/node/output'
|
|
7
|
+
require_relative '../../../bolt/util'
|
|
8
8
|
|
|
9
9
|
module Bolt
|
|
10
10
|
module Transport
|
data/lib/bolt/transport/ssh.rb
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
require_relative '../../bolt/logger'
|
|
4
|
+
require_relative '../../bolt/node/errors'
|
|
5
|
+
require_relative '../../bolt/transport/simple'
|
|
6
6
|
|
|
7
7
|
module Bolt
|
|
8
8
|
module Transport
|
|
@@ -44,5 +44,5 @@ module Bolt
|
|
|
44
44
|
end
|
|
45
45
|
end
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
require_relative 'ssh/connection'
|
|
48
|
+
require_relative 'ssh/exec_connection'
|
data/lib/bolt/transport/winrm.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
require_relative '../../bolt/node/errors'
|
|
4
|
+
require_relative '../../bolt/transport/base'
|
|
5
5
|
|
|
6
6
|
module Bolt
|
|
7
7
|
module Transport
|
|
@@ -30,4 +30,4 @@ module Bolt
|
|
|
30
30
|
end
|
|
31
31
|
end
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
require_relative 'winrm/connection'
|
data/lib/bolt/util.rb
CHANGED
|
@@ -103,7 +103,7 @@ module Bolt
|
|
|
103
103
|
# absolute path or Puppet module syntax lookup. Returns the path to the
|
|
104
104
|
# file if found, or nil.
|
|
105
105
|
#
|
|
106
|
-
def find_file_from_scope(file, scope
|
|
106
|
+
def find_file_from_scope(file, scope)
|
|
107
107
|
# If we got an absolute path, just return that.
|
|
108
108
|
return file if Pathname.new(file).absolute?
|
|
109
109
|
|
|
@@ -112,44 +112,21 @@ module Bolt
|
|
|
112
112
|
mod_path = scope.compiler.environment.module(module_name)&.path
|
|
113
113
|
|
|
114
114
|
# Search the module for the file, falling back to new-style paths if enabled.
|
|
115
|
-
|
|
115
|
+
search_module(mod_path, file_pattern) if mod_path
|
|
116
116
|
end
|
|
117
117
|
|
|
118
|
-
# This
|
|
119
|
-
#
|
|
120
|
-
#
|
|
121
|
-
# searches subdirectories in the module in order of precedence.
|
|
118
|
+
# This searches a module for files under 'files/' or 'scripts/', falling
|
|
119
|
+
# back to the new style of file loading. It takes the absolute path to the
|
|
120
|
+
# module root and the relative path provided by the user.
|
|
122
121
|
#
|
|
123
|
-
def
|
|
124
|
-
# If the first part of the path is 'scripts' or 'files', the path may
|
|
125
|
-
# be a new-style file location and should fall back to the new path.
|
|
126
|
-
subdir_or_file = split_path(module_file).first
|
|
127
|
-
case subdir_or_file
|
|
128
|
-
# For any subdirs that may indicate the user passed a new-style path,
|
|
129
|
-
# first look in 'mymod/files/<relative_path>' (old-style) then fall
|
|
130
|
-
# back to 'mymod/<relative_path>' (new-style) if enabled.
|
|
131
|
-
when 'scripts', 'files'
|
|
132
|
-
search_module(module_path, module_file, fallback)
|
|
133
|
-
else
|
|
134
|
-
# If the path definitely isn't new-style, only look in the 'files/'
|
|
135
|
-
# directory.
|
|
136
|
-
search_module(module_path, module_file)
|
|
137
|
-
end
|
|
138
|
-
end
|
|
139
|
-
|
|
140
|
-
# This searches a module for files under 'files/' or 'scripts/',
|
|
141
|
-
# optionally falling back to the new style of file loading. It takes the
|
|
142
|
-
# absolute path to the module root, the relative path provided by the
|
|
143
|
-
# user, and whether to fall back to the new-style script loading if the
|
|
144
|
-
# file isn't found in 'files/'.
|
|
145
|
-
#
|
|
146
|
-
private def search_module(module_path, module_file, fallback = false)
|
|
122
|
+
def search_module(module_path, module_file)
|
|
147
123
|
if File.exist?(File.join(module_path, 'files', module_file))
|
|
148
124
|
File.join(module_path, 'files', module_file)
|
|
149
|
-
elsif File.exist?(File.join(module_path, module_file))
|
|
125
|
+
elsif File.exist?(File.join(module_path, module_file))
|
|
150
126
|
File.join(module_path, module_file)
|
|
151
127
|
end
|
|
152
128
|
end
|
|
129
|
+
alias find_file_in_module search_module
|
|
153
130
|
|
|
154
131
|
# Copied directly from puppet/lib/puppet/parser/files.rb
|
|
155
132
|
#
|
data/lib/bolt/validator.rb
CHANGED
data/lib/bolt/version.rb
CHANGED
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
|
|
@@ -468,13 +469,26 @@ module BoltServer
|
|
|
468
469
|
pal.in_bolt_compiler do
|
|
469
470
|
mod = Puppet.lookup(:current_environment).module(module_name)
|
|
470
471
|
raise BoltServer::RequestError, "module_name: '#{module_name}' does not exist" unless mod
|
|
471
|
-
|
|
472
|
+
# First, look in the 'old' location <module>/files/<path>.
|
|
473
|
+
# If not found, and the path starts with `files` or `scripts`, munge
|
|
474
|
+
# the path and look inside that directory.
|
|
475
|
+
if (abs_path = mod.file(file))
|
|
476
|
+
abs_path
|
|
477
|
+
else
|
|
478
|
+
subdir, relative_path = file.split(File::SEPARATOR, 2)
|
|
479
|
+
case subdir
|
|
480
|
+
when 'files'
|
|
481
|
+
mod.file(relative_path)
|
|
482
|
+
when 'scripts'
|
|
483
|
+
mod.script(relative_path)
|
|
484
|
+
end
|
|
485
|
+
end
|
|
472
486
|
end
|
|
473
487
|
end
|
|
474
488
|
|
|
475
489
|
unless abs_file_path
|
|
476
490
|
raise BoltServer::RequestError,
|
|
477
|
-
"file: '#{file}' does not exist inside
|
|
491
|
+
"file: '#{file}' does not exist inside #{module_name} 'files' or 'scripts' directories"
|
|
478
492
|
end
|
|
479
493
|
|
|
480
494
|
fileset = Puppet::FileServing::Fileset.new(abs_file_path, 'recurse' => 'yes')
|
|
@@ -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.18.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-09-20 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
|