bolt 2.42.0 → 2.44.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 +12 -12
- data/bolt-modules/boltlib/lib/puppet/functions/parallelize.rb +6 -8
- data/lib/bolt/analytics.rb +3 -2
- data/lib/bolt/applicator.rb +11 -1
- data/lib/bolt/bolt_option_parser.rb +20 -13
- data/lib/bolt/catalog.rb +10 -29
- data/lib/bolt/cli.rb +22 -32
- data/lib/bolt/config.rb +84 -82
- data/lib/bolt/config/options.rb +68 -0
- data/lib/bolt/config/transport/options.rb +7 -0
- data/lib/bolt/config/transport/orch.rb +1 -0
- data/lib/bolt/executor.rb +15 -5
- data/lib/bolt/inventory.rb +1 -1
- data/lib/bolt/inventory/group.rb +7 -4
- data/lib/bolt/logger.rb +114 -10
- data/lib/bolt/module_installer.rb +4 -2
- data/lib/bolt/module_installer/resolver.rb +59 -14
- data/lib/bolt/module_installer/specs/forge_spec.rb +8 -2
- data/lib/bolt/module_installer/specs/git_spec.rb +17 -2
- data/lib/bolt/outputter/human.rb +8 -4
- data/lib/bolt/outputter/rainbow.rb +3 -3
- data/lib/bolt/pal.rb +93 -14
- data/lib/bolt/pal/yaml_plan.rb +8 -2
- data/lib/bolt/pal/yaml_plan/evaluator.rb +2 -2
- data/lib/bolt/pal/yaml_plan/transpiler.rb +1 -0
- data/lib/bolt/plugin.rb +2 -2
- data/lib/bolt/plugin/cache.rb +7 -7
- data/lib/bolt/plugin/module.rb +1 -1
- data/lib/bolt/plugin/puppet_connect_data.rb +35 -0
- data/lib/bolt/plugin/puppetdb.rb +1 -1
- data/lib/bolt/project.rb +56 -43
- data/lib/bolt/rerun.rb +1 -1
- data/lib/bolt/shell/bash.rb +1 -1
- data/lib/bolt/shell/bash/tmpdir.rb +4 -1
- data/lib/bolt/shell/powershell.rb +2 -2
- data/lib/bolt/task.rb +1 -1
- data/lib/bolt/transport/docker/connection.rb +2 -2
- data/lib/bolt/transport/local.rb +1 -1
- data/lib/bolt/transport/orch/connection.rb +1 -1
- data/lib/bolt/transport/ssh.rb +1 -2
- data/lib/bolt/transport/ssh/connection.rb +1 -1
- data/lib/bolt/validator.rb +2 -2
- data/lib/bolt/version.rb +1 -1
- data/lib/bolt_server/config.rb +1 -1
- data/lib/bolt_server/transport_app.rb +2 -1
- data/libexec/bolt_catalog +1 -1
- metadata +9 -8
data/lib/bolt/project.rb
CHANGED
@@ -12,46 +12,49 @@ module Bolt
|
|
12
12
|
CONFIG_NAME = 'bolt-project.yaml'
|
13
13
|
|
14
14
|
attr_reader :path, :data, :config_file, :inventory_file, :hiera_config,
|
15
|
-
:puppetfile, :rerunfile, :type, :resource_types, :
|
16
|
-
:
|
17
|
-
:backup_dir, :
|
15
|
+
:puppetfile, :rerunfile, :type, :resource_types, :project_file,
|
16
|
+
:downloads, :plans_path, :modulepath, :managed_moduledir,
|
17
|
+
:backup_dir, :plugin_cache_file, :plan_cache_file
|
18
18
|
|
19
|
-
def self.default_project
|
20
|
-
create_project(File.expand_path(File.join('~', '.puppetlabs', 'bolt')), 'user'
|
19
|
+
def self.default_project
|
20
|
+
create_project(File.expand_path(File.join('~', '.puppetlabs', 'bolt')), 'user')
|
21
21
|
# If homedir isn't defined use the system config path
|
22
22
|
rescue ArgumentError
|
23
|
-
create_project(Bolt::Config.system_path, 'system'
|
23
|
+
create_project(Bolt::Config.system_path, 'system')
|
24
24
|
end
|
25
25
|
|
26
26
|
# Search recursively up the directory hierarchy for the Project. Look for a
|
27
27
|
# directory called Boltdir or a file called bolt.yaml (for a control repo
|
28
28
|
# type Project). Otherwise, repeat the check on each directory up the
|
29
29
|
# hierarchy, falling back to the default if we reach the root.
|
30
|
-
def self.find_boltdir(dir
|
30
|
+
def self.find_boltdir(dir)
|
31
31
|
dir = Pathname.new(dir)
|
32
32
|
|
33
33
|
if (dir + BOLTDIR_NAME).directory?
|
34
|
-
create_project(dir + BOLTDIR_NAME, 'embedded'
|
34
|
+
create_project(dir + BOLTDIR_NAME, 'embedded')
|
35
35
|
elsif (dir + 'bolt.yaml').file?
|
36
36
|
command = Bolt::Util.powershell? ? 'Update-BoltProject' : 'bolt project migrate'
|
37
|
-
|
37
|
+
Bolt::Logger.deprecate(
|
38
|
+
"bolt_yaml",
|
39
|
+
"Configuration file #{dir + 'bolt.yaml'} is deprecated and will be "\
|
38
40
|
"removed in Bolt 3.0.\nUpdate your Bolt project to the latest Bolt practices "\
|
39
|
-
"using #{command}"
|
40
|
-
|
41
|
-
|
42
|
-
create_project(dir, 'local', logs, deprecations)
|
41
|
+
"using #{command}."
|
42
|
+
)
|
43
|
+
create_project(dir, 'local')
|
43
44
|
elsif (dir + CONFIG_NAME).file?
|
44
|
-
create_project(dir, 'local'
|
45
|
+
create_project(dir, 'local')
|
45
46
|
elsif dir.root?
|
46
|
-
default_project
|
47
|
+
default_project
|
47
48
|
else
|
48
|
-
|
49
|
-
|
50
|
-
|
49
|
+
Bolt::Logger.debug(
|
50
|
+
"Did not detect Boltdir, bolt.yaml, or bolt-project.yaml at '#{dir}'. "\
|
51
|
+
"This directory won't be loaded as a project."
|
52
|
+
)
|
53
|
+
find_boltdir(dir.parent)
|
51
54
|
end
|
52
55
|
end
|
53
56
|
|
54
|
-
def self.create_project(path, type = 'option'
|
57
|
+
def self.create_project(path, type = 'option')
|
55
58
|
fullpath = Pathname.new(path).expand_path
|
56
59
|
|
57
60
|
if type == 'user'
|
@@ -59,8 +62,11 @@ module Bolt
|
|
59
62
|
# This is already expanded if the type is user
|
60
63
|
FileUtils.mkdir_p(path)
|
61
64
|
rescue StandardError
|
62
|
-
|
63
|
-
|
65
|
+
Bolt::Logger.warn(
|
66
|
+
"non_writeable_project",
|
67
|
+
"Could not create default project at #{path}. Continuing without a writeable project. "\
|
68
|
+
"Log and rerun files will not be written."
|
69
|
+
)
|
64
70
|
end
|
65
71
|
end
|
66
72
|
|
@@ -81,19 +87,17 @@ module Bolt
|
|
81
87
|
default = type =~ /user|system/ ? 'default ' : ''
|
82
88
|
exist = File.exist?(File.expand_path(project_file))
|
83
89
|
|
84
|
-
|
90
|
+
if exist
|
91
|
+
Bolt::Logger.info("Loaded #{default}project from '#{fullpath}'")
|
92
|
+
end
|
85
93
|
|
86
94
|
Bolt::Validator.new.tap do |validator|
|
87
95
|
validator.validate(data, schema, project_file)
|
88
|
-
|
89
|
-
validator.
|
90
|
-
|
91
|
-
validator.deprecations.each do |dep|
|
92
|
-
deprecations << { type: "#{CONFIG_NAME} #{dep[:option]}", msg: dep[:message] }
|
93
|
-
end
|
96
|
+
validator.warnings.each { |warning| Bolt::Logger.warn(warning[:id], warning[:msg]) }
|
97
|
+
validator.deprecations.each { |dep| Bolt::Logger.deprecate(dep[:id], dep[:msg]) }
|
94
98
|
end
|
95
99
|
|
96
|
-
new(data, path, type
|
100
|
+
new(data, path, type)
|
97
101
|
end
|
98
102
|
|
99
103
|
# Builds the schema for bolt-project.yaml used by the validator.
|
@@ -106,17 +110,17 @@ module Bolt
|
|
106
110
|
}
|
107
111
|
end
|
108
112
|
|
109
|
-
def initialize(raw_data, path, type = 'option'
|
113
|
+
def initialize(raw_data, path, type = 'option')
|
110
114
|
@path = Pathname.new(path).expand_path
|
111
115
|
@project_file = @path + CONFIG_NAME
|
112
|
-
@logs = logs
|
113
|
-
@deprecations = deprecations
|
114
116
|
|
115
117
|
if (@path + 'bolt.yaml').file? && project_file?
|
116
|
-
|
118
|
+
Bolt::Logger.deprecate(
|
119
|
+
"bolt_yaml",
|
120
|
+
"Project-level configuration in bolt.yaml is deprecated if using bolt-project.yaml. "\
|
117
121
|
"Transport config should be set in inventory.yaml, all other config should be set in "\
|
118
122
|
"bolt-project.yaml."
|
119
|
-
|
123
|
+
)
|
120
124
|
end
|
121
125
|
|
122
126
|
@inventory_file = @path + 'inventory.yaml'
|
@@ -129,12 +133,14 @@ module Bolt
|
|
129
133
|
@plans_path = @path + 'plans'
|
130
134
|
@managed_moduledir = @path + '.modules'
|
131
135
|
@backup_dir = @path + '.bolt-bak'
|
132
|
-
@
|
136
|
+
@plugin_cache_file = @path + '.plugin_cache.json'
|
137
|
+
@plan_cache_file = @path + '.plan_cache.json'
|
133
138
|
|
134
|
-
tc = Bolt::Config::INVENTORY_OPTIONS.keys & raw_data.keys
|
135
|
-
|
136
|
-
|
137
|
-
|
139
|
+
if (tc = Bolt::Config::INVENTORY_OPTIONS.keys & raw_data.keys).any?
|
140
|
+
Bolt::Logger.warn(
|
141
|
+
"project_transport_config",
|
142
|
+
"Transport configuration isn't supported in bolt-project.yaml. Ignoring keys #{tc}."
|
143
|
+
)
|
138
144
|
end
|
139
145
|
|
140
146
|
@data = raw_data.reject { |k, _| Bolt::Config::INVENTORY_OPTIONS.include?(k) }
|
@@ -151,8 +157,10 @@ module Bolt
|
|
151
157
|
# and replaced with .project_file in lib/bolt/config.rb
|
152
158
|
@config_file = if (Bolt::Config::BOLT_OPTIONS & @data.keys).any?
|
153
159
|
if (@path + 'bolt.yaml').file?
|
154
|
-
|
155
|
-
|
160
|
+
Bolt::Logger.warn(
|
161
|
+
"project_config_conflict",
|
162
|
+
"bolt-project.yaml contains valid config keys, bolt.yaml will be ignored"
|
163
|
+
)
|
156
164
|
end
|
157
165
|
@project_file
|
158
166
|
else
|
@@ -206,6 +214,10 @@ module Bolt
|
|
206
214
|
@data['module-install']
|
207
215
|
end
|
208
216
|
|
217
|
+
def disable_warnings
|
218
|
+
@data['disable-warnings'] || []
|
219
|
+
end
|
220
|
+
|
209
221
|
def modules
|
210
222
|
@modules ||= @data['modules']&.map do |mod|
|
211
223
|
if mod.is_a?(String)
|
@@ -232,14 +244,15 @@ module Bolt
|
|
232
244
|
File.directory?(@path + 'tasks') ||
|
233
245
|
File.directory?(@path + 'files'))
|
234
246
|
message = "No project name is specified in bolt-project.yaml. Project-level content will not be available."
|
235
|
-
|
247
|
+
|
248
|
+
Bolt::Logger.warn("missing_project_name", message)
|
236
249
|
end
|
237
250
|
end
|
238
251
|
|
239
252
|
def check_deprecated_file
|
240
253
|
if (@path + 'project.yaml').file?
|
241
254
|
msg = "Project configuration file 'project.yaml' is deprecated; use 'bolt-project.yaml' instead."
|
242
|
-
Bolt::Logger.
|
255
|
+
Bolt::Logger.warn("project_yaml", msg)
|
243
256
|
end
|
244
257
|
end
|
245
258
|
end
|
data/lib/bolt/rerun.rb
CHANGED
@@ -49,7 +49,7 @@ module Bolt
|
|
49
49
|
end
|
50
50
|
end
|
51
51
|
rescue StandardError => e
|
52
|
-
Bolt::Logger.warn_once(
|
52
|
+
Bolt::Logger.warn_once("unwriteable_file", "Failed to save result to #{@path}: #{e.message}")
|
53
53
|
end
|
54
54
|
end
|
55
55
|
end
|
data/lib/bolt/shell/bash.rb
CHANGED
@@ -48,7 +48,10 @@ module Bolt
|
|
48
48
|
def delete
|
49
49
|
result = @shell.execute(['rm', '-rf', @path], sudoable: true, run_as: @owner)
|
50
50
|
if result.exit_code != 0
|
51
|
-
|
51
|
+
Bolt::Logger.warn(
|
52
|
+
"fail_cleanup",
|
53
|
+
"Failed to clean up tmpdir '#{@path}': #{result.stderr.string}"
|
54
|
+
)
|
52
55
|
end
|
53
56
|
# For testing
|
54
57
|
result.stderr.string
|
@@ -27,7 +27,7 @@ module Bolt
|
|
27
27
|
"bolt-debug.log or run with '--log-level debug' to see the full "\
|
28
28
|
"list of targets with PowerShell 2."
|
29
29
|
|
30
|
-
Bolt::Logger.
|
30
|
+
Bolt::Logger.deprecate_once("powershell_2", msg)
|
31
31
|
@logger.debug("Detected PowerShell 2 on #{target}.")
|
32
32
|
end
|
33
33
|
end
|
@@ -163,7 +163,7 @@ module Bolt
|
|
163
163
|
if target.options['cleanup']
|
164
164
|
rmdir(@tmpdir)
|
165
165
|
else
|
166
|
-
|
166
|
+
Bolt::Logger.warn("Skipping cleanup of tmpdir '#{@tmpdir}'", "skip_cleanup")
|
167
167
|
end
|
168
168
|
end
|
169
169
|
end
|
data/lib/bolt/task.rb
CHANGED
@@ -149,7 +149,7 @@ module Bolt
|
|
149
149
|
if unknown_keys.any?
|
150
150
|
msg = "Metadata for task '#{@name}' contains unknown keys: #{unknown_keys.join(', ')}."
|
151
151
|
msg += " This could be a typo in the task metadata or may result in incorrect behavior."
|
152
|
-
|
152
|
+
Bolt::Logger.warn("unknown_task_metadata_keys", msg)
|
153
153
|
end
|
154
154
|
end
|
155
155
|
end
|
@@ -140,10 +140,10 @@ module Bolt
|
|
140
140
|
if @target.options['cleanup']
|
141
141
|
_, stderr, exitcode = execute('rm', '-rf', dir, {})
|
142
142
|
if exitcode != 0
|
143
|
-
|
143
|
+
Bolt::Logger.warn("fail_cleanup", "Failed to clean up tmpdir '#{dir}': #{stderr}")
|
144
144
|
end
|
145
145
|
else
|
146
|
-
|
146
|
+
Bolt::Logger.warn("skip_cleanup", "Skipping cleanup of tmpdir '#{dir}'")
|
147
147
|
end
|
148
148
|
end
|
149
149
|
end
|
data/lib/bolt/transport/local.rb
CHANGED
@@ -20,7 +20,7 @@ module Bolt
|
|
20
20
|
msg = "The local transport will default to using Bolt's Ruby interpreter and "\
|
21
21
|
"setting the 'puppet-agent' feature in Bolt 3.0. Enable or disable these "\
|
22
22
|
"defaults by setting 'bundled-ruby' in the local transport config."
|
23
|
-
Bolt::Logger.warn_once(
|
23
|
+
Bolt::Logger.warn_once("local_default_config", msg)
|
24
24
|
end
|
25
25
|
|
26
26
|
yield Connection.new(target)
|
@@ -21,7 +21,7 @@ module Bolt
|
|
21
21
|
|
22
22
|
@logger = logger
|
23
23
|
@key = self.class.get_key(opts)
|
24
|
-
client_opts = opts.slice('token-file', 'cacert', 'job-poll-interval', 'job-poll-timeout')
|
24
|
+
client_opts = opts.slice('token-file', 'cacert', 'job-poll-interval', 'job-poll-timeout', 'read-timeout')
|
25
25
|
|
26
26
|
if opts['service-url']
|
27
27
|
uri = Addressable::URI.parse(opts['service-url'])
|
data/lib/bolt/transport/ssh.rb
CHANGED
@@ -23,8 +23,7 @@ module Bolt
|
|
23
23
|
|
24
24
|
def with_connection(target)
|
25
25
|
if target.transport_config['ssh-command'] && !target.transport_config['native-ssh']
|
26
|
-
Bolt::Logger.warn_once("
|
27
|
-
"native-ssh must be true to use ssh-command")
|
26
|
+
Bolt::Logger.warn_once("native_ssh_disabled", "native-ssh must be true to use ssh-command")
|
28
27
|
end
|
29
28
|
|
30
29
|
conn = if target.transport_config['native-ssh']
|
data/lib/bolt/validator.rb
CHANGED
@@ -147,7 +147,7 @@ module Bolt
|
|
147
147
|
message += " at '#{path}'" if @path.any?
|
148
148
|
message += " at #{@location}" if @location
|
149
149
|
message += "."
|
150
|
-
@warnings << message
|
150
|
+
@warnings << { id: 'unknown_option', msg: message }
|
151
151
|
end
|
152
152
|
end
|
153
153
|
|
@@ -160,7 +160,7 @@ module Bolt
|
|
160
160
|
message = "Option '#{path}' "
|
161
161
|
message += "at #{@location} " if @location
|
162
162
|
message += "is deprecated. #{definition[:_deprecation]}"
|
163
|
-
@deprecations << {
|
163
|
+
@deprecations << { id: "#{key}_option", msg: message }
|
164
164
|
end
|
165
165
|
end
|
166
166
|
|
data/lib/bolt/version.rb
CHANGED
data/lib/bolt_server/config.rb
CHANGED
@@ -9,7 +9,7 @@ module BoltServer
|
|
9
9
|
def config_keys
|
10
10
|
super + %w[concurrency cache-dir file-server-conn-timeout
|
11
11
|
file-server-uri projects-dir environments-codedir
|
12
|
-
environmentpath basemodulepath]
|
12
|
+
environmentpath basemodulepath builtin-content-dir]
|
13
13
|
end
|
14
14
|
|
15
15
|
def env_keys
|
@@ -280,7 +280,8 @@ module BoltServer
|
|
280
280
|
bolt_config = config_from_project(versioned_project)
|
281
281
|
modulepath_object = Bolt::Config::Modulepath.new(
|
282
282
|
bolt_config.modulepath,
|
283
|
-
boltlib_path: [PE_BOLTLIB_PATH, Bolt::Config::Modulepath::BOLTLIB_PATH]
|
283
|
+
boltlib_path: [PE_BOLTLIB_PATH, Bolt::Config::Modulepath::BOLTLIB_PATH],
|
284
|
+
builtin_content_path: @config['builtin-content-dir']
|
284
285
|
)
|
285
286
|
pal = Bolt::PAL.new(modulepath_object, nil, nil, nil, nil, nil, bolt_config.project)
|
286
287
|
context = {
|
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: 2.
|
4
|
+
version: 2.44.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-01-
|
11
|
+
date: 2021-01-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -184,14 +184,14 @@ dependencies:
|
|
184
184
|
requirements:
|
185
185
|
- - "~>"
|
186
186
|
- !ruby/object:Gem::Version
|
187
|
-
version: '0.
|
187
|
+
version: '0.5'
|
188
188
|
type: :runtime
|
189
189
|
prerelease: false
|
190
190
|
version_requirements: !ruby/object:Gem::Requirement
|
191
191
|
requirements:
|
192
192
|
- - "~>"
|
193
193
|
- !ruby/object:Gem::Version
|
194
|
-
version: '0.
|
194
|
+
version: '0.5'
|
195
195
|
- !ruby/object:Gem::Dependency
|
196
196
|
name: puppet
|
197
197
|
requirement: !ruby/object:Gem::Requirement
|
@@ -350,16 +350,16 @@ dependencies:
|
|
350
350
|
name: puppetlabs_spec_helper
|
351
351
|
requirement: !ruby/object:Gem::Requirement
|
352
352
|
requirements:
|
353
|
-
- - "
|
353
|
+
- - "<="
|
354
354
|
- !ruby/object:Gem::Version
|
355
|
-
version:
|
355
|
+
version: 2.15.0
|
356
356
|
type: :development
|
357
357
|
prerelease: false
|
358
358
|
version_requirements: !ruby/object:Gem::Requirement
|
359
359
|
requirements:
|
360
|
-
- - "
|
360
|
+
- - "<="
|
361
361
|
- !ruby/object:Gem::Version
|
362
|
-
version:
|
362
|
+
version: 2.15.0
|
363
363
|
- !ruby/object:Gem::Dependency
|
364
364
|
name: rake
|
365
365
|
requirement: !ruby/object:Gem::Requirement
|
@@ -523,6 +523,7 @@ files:
|
|
523
523
|
- lib/bolt/plugin/env_var.rb
|
524
524
|
- lib/bolt/plugin/module.rb
|
525
525
|
- lib/bolt/plugin/prompt.rb
|
526
|
+
- lib/bolt/plugin/puppet_connect_data.rb
|
526
527
|
- lib/bolt/plugin/puppetdb.rb
|
527
528
|
- lib/bolt/plugin/task.rb
|
528
529
|
- lib/bolt/project.rb
|