bolt 2.42.0 → 3.3.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 +21 -19
- data/bolt-modules/boltlib/lib/puppet/functions/add_facts.rb +1 -1
- data/bolt-modules/boltlib/lib/puppet/functions/apply_prep.rb +25 -0
- data/bolt-modules/boltlib/lib/puppet/functions/parallelize.rb +6 -8
- data/bolt-modules/boltlib/lib/puppet/functions/run_plan.rb +2 -2
- data/bolt-modules/boltlib/lib/puppet/functions/run_script.rb +27 -5
- data/bolt-modules/boltlib/lib/puppet/functions/upload_file.rb +1 -1
- data/bolt-modules/boltlib/lib/puppet/functions/wait_until_available.rb +7 -3
- data/bolt-modules/file/lib/puppet/functions/file/read.rb +3 -2
- data/lib/bolt/analytics.rb +3 -2
- data/lib/bolt/applicator.rb +11 -1
- data/lib/bolt/apply_result.rb +1 -1
- data/lib/bolt/bolt_option_parser.rb +9 -116
- data/lib/bolt/catalog.rb +10 -29
- data/lib/bolt/cli.rb +90 -154
- data/lib/bolt/config.rb +66 -239
- data/lib/bolt/config/options.rb +79 -102
- data/lib/bolt/config/transport/local.rb +1 -0
- data/lib/bolt/config/transport/lxd.rb +21 -0
- data/lib/bolt/config/transport/options.rb +9 -2
- data/lib/bolt/config/transport/orch.rb +1 -0
- data/lib/bolt/executor.rb +23 -6
- data/lib/bolt/inventory.rb +1 -1
- data/lib/bolt/inventory/group.rb +7 -4
- data/lib/bolt/logger.rb +123 -11
- data/lib/bolt/module_installer.rb +6 -4
- data/lib/bolt/module_installer/puppetfile.rb +2 -2
- data/lib/bolt/module_installer/resolver.rb +59 -14
- data/lib/bolt/module_installer/specs/forge_spec.rb +10 -4
- data/lib/bolt/module_installer/specs/git_spec.rb +19 -4
- data/lib/bolt/outputter/human.rb +56 -17
- data/lib/bolt/outputter/json.rb +16 -16
- data/lib/bolt/outputter/rainbow.rb +3 -3
- data/lib/bolt/pal.rb +95 -15
- data/lib/bolt/pal/yaml_plan.rb +9 -4
- data/lib/bolt/pal/yaml_plan/evaluator.rb +5 -153
- data/lib/bolt/pal/yaml_plan/step.rb +91 -52
- data/lib/bolt/pal/yaml_plan/step/command.rb +16 -16
- data/lib/bolt/pal/yaml_plan/step/download.rb +15 -16
- data/lib/bolt/pal/yaml_plan/step/eval.rb +11 -11
- data/lib/bolt/pal/yaml_plan/step/message.rb +13 -4
- data/lib/bolt/pal/yaml_plan/step/plan.rb +19 -15
- data/lib/bolt/pal/yaml_plan/step/resources.rb +82 -21
- data/lib/bolt/pal/yaml_plan/step/script.rb +32 -17
- data/lib/bolt/pal/yaml_plan/step/task.rb +19 -16
- data/lib/bolt/pal/yaml_plan/step/upload.rb +16 -17
- data/lib/bolt/pal/yaml_plan/transpiler.rb +2 -1
- data/lib/bolt/plan_creator.rb +1 -1
- data/lib/bolt/plugin.rb +2 -2
- data/lib/bolt/plugin/cache.rb +7 -7
- data/lib/bolt/plugin/module.rb +0 -23
- data/lib/bolt/plugin/puppet_connect_data.rb +77 -0
- data/lib/bolt/plugin/puppetdb.rb +1 -1
- data/lib/bolt/project.rb +54 -81
- data/lib/bolt/project_manager.rb +5 -4
- data/lib/bolt/project_manager/module_migrator.rb +7 -6
- data/lib/bolt/rerun.rb +1 -1
- data/lib/bolt/result.rb +6 -1
- data/lib/bolt/shell.rb +16 -0
- data/lib/bolt/shell/bash.rb +57 -25
- data/lib/bolt/shell/bash/tmpdir.rb +6 -3
- data/lib/bolt/shell/powershell.rb +33 -10
- data/lib/bolt/shell/powershell/snippets.rb +37 -150
- data/lib/bolt/task.rb +2 -2
- data/lib/bolt/transport/base.rb +0 -9
- data/lib/bolt/transport/docker.rb +1 -125
- data/lib/bolt/transport/docker/connection.rb +86 -161
- data/lib/bolt/transport/local.rb +1 -9
- data/lib/bolt/transport/lxd.rb +26 -0
- data/lib/bolt/transport/lxd/connection.rb +99 -0
- data/lib/bolt/transport/orch/connection.rb +1 -1
- data/lib/bolt/transport/ssh.rb +1 -2
- data/lib/bolt/transport/ssh/connection.rb +2 -2
- data/lib/bolt/transport/winrm/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 +61 -32
- data/lib/bolt_spec/bolt_context.rb +9 -4
- data/lib/bolt_spec/plans.rb +1 -109
- data/lib/bolt_spec/plans/action_stubs.rb +1 -1
- data/lib/bolt_spec/plans/mock_executor.rb +4 -0
- data/libexec/bolt_catalog +1 -1
- data/modules/aggregate/plans/count.pp +21 -0
- data/modules/aggregate/plans/targets.pp +21 -0
- data/modules/puppet_connect/plans/test_input_data.pp +67 -0
- data/modules/puppetdb_fact/plans/init.pp +10 -0
- metadata +13 -9
- data/modules/aggregate/plans/nodes.pp +0 -36
data/lib/bolt/config.rb
CHANGED
@@ -20,10 +20,9 @@ module Bolt
|
|
20
20
|
class Config
|
21
21
|
include Bolt::Config::Options
|
22
22
|
|
23
|
-
attr_reader :config_files, :
|
23
|
+
attr_reader :config_files, :data, :transports, :project, :modified_concurrency
|
24
24
|
|
25
|
-
|
26
|
-
BOLT_DEFAULTS_NAME = 'bolt-defaults.yaml'
|
25
|
+
DEFAULTS_NAME = 'bolt-defaults.yaml'
|
27
26
|
|
28
27
|
# The default concurrency value that is used when the ulimit is not low (i.e. < 700)
|
29
28
|
DEFAULT_DEFAULT_CONCURRENCY = 100
|
@@ -33,70 +32,9 @@ module Bolt
|
|
33
32
|
end
|
34
33
|
|
35
34
|
def self.from_project(project, overrides = {})
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
conf = if project.project_file == project.config_file
|
40
|
-
project.data
|
41
|
-
else
|
42
|
-
c = Bolt::Util.read_optional_yaml_hash(project.config_file, 'config')
|
43
|
-
|
44
|
-
# Validate the config against the schema. This will raise a single error
|
45
|
-
# with all validation errors.
|
46
|
-
Bolt::Validator.new.tap do |validator|
|
47
|
-
validator.validate(c, bolt_schema, project.config_file.to_s)
|
48
|
-
|
49
|
-
validator.warnings.each { |warning| logs << { warn: warning } }
|
50
|
-
|
51
|
-
validator.deprecations.each do |dep|
|
52
|
-
deprecations << { type: "#{BOLT_CONFIG_NAME} #{dep[:option]}", msg: dep[:message] }
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
logs << { debug: "Loaded configuration from #{project.config_file}" } if File.exist?(project.config_file)
|
57
|
-
c
|
58
|
-
end
|
59
|
-
data = load_defaults(project).push(
|
60
|
-
filepath: project.config_file,
|
61
|
-
data: conf,
|
62
|
-
logs: logs,
|
63
|
-
deprecations: deprecations
|
64
|
-
)
|
65
|
-
|
66
|
-
new(project, data, overrides)
|
67
|
-
end
|
68
|
-
|
69
|
-
def self.from_file(configfile, overrides = {})
|
70
|
-
project = Bolt::Project.create_project(Pathname.new(configfile).expand_path.dirname)
|
71
|
-
logs = []
|
72
|
-
deprecations = []
|
73
|
-
|
74
|
-
conf = if project.project_file == project.config_file
|
75
|
-
project.data
|
76
|
-
else
|
77
|
-
c = Bolt::Util.read_yaml_hash(configfile, 'config')
|
78
|
-
|
79
|
-
# Validate the config against the schema. This will raise a single error
|
80
|
-
# with all validation errors.
|
81
|
-
Bolt::Validator.new.tap do |validator|
|
82
|
-
validator.validate(c, bolt_schema, project.config_file.to_s)
|
83
|
-
|
84
|
-
validator.warnings.each { |warning| logs << { warn: warning } }
|
85
|
-
|
86
|
-
validator.deprecations.each do |dep|
|
87
|
-
deprecations << { type: "#{BOLT_CONFIG_NAME} #{dep[:option]}", msg: dep[:message] }
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
logs << { debug: "Loaded configuration from #{configfile}" }
|
92
|
-
c
|
93
|
-
end
|
94
|
-
|
95
|
-
data = load_defaults(project).push(
|
96
|
-
filepath: configfile,
|
97
|
-
data: conf,
|
98
|
-
logs: logs,
|
99
|
-
deprecations: deprecations
|
35
|
+
data = load_defaults.push(
|
36
|
+
filepath: project.project_file,
|
37
|
+
data: project.data
|
100
38
|
)
|
101
39
|
|
102
40
|
new(project, data, overrides)
|
@@ -115,7 +53,7 @@ module Bolt
|
|
115
53
|
def self.defaults_schema
|
116
54
|
schema = {
|
117
55
|
type: Hash,
|
118
|
-
properties:
|
56
|
+
properties: DEFAULTS_OPTIONS.map { |opt| [opt, _ref: opt] }.to_h,
|
119
57
|
definitions: OPTIONS.merge(transport_definitions)
|
120
58
|
}
|
121
59
|
|
@@ -124,16 +62,6 @@ module Bolt
|
|
124
62
|
schema
|
125
63
|
end
|
126
64
|
|
127
|
-
# Builds the schema for bolt.yaml used by the validator.
|
128
|
-
#
|
129
|
-
def self.bolt_schema
|
130
|
-
{
|
131
|
-
type: Hash,
|
132
|
-
properties: (BOLT_OPTIONS + INVENTORY_OPTIONS.keys).map { |opt| [opt, _ref: opt] }.to_h,
|
133
|
-
definitions: OPTIONS.merge(transport_definitions)
|
134
|
-
}
|
135
|
-
end
|
136
|
-
|
137
65
|
def self.system_path
|
138
66
|
if Bolt::Util.windows?
|
139
67
|
Pathname.new(File.join(ENV['ALLUSERSPROFILE'], 'PuppetLabs', 'bolt', 'etc'))
|
@@ -149,41 +77,31 @@ module Bolt
|
|
149
77
|
end
|
150
78
|
|
151
79
|
# Loads a 'bolt-defaults.yaml' file, which contains default configuration that applies to all
|
152
|
-
# projects. This file does not allow project-specific configuration such as 'hiera-config'
|
153
|
-
#
|
80
|
+
# projects. This file does not allow project-specific configuration such as 'hiera-config'
|
81
|
+
# and nests all default inventory configuration under an 'inventory-config' key.
|
154
82
|
def self.load_bolt_defaults_yaml(dir)
|
155
|
-
filepath = dir +
|
83
|
+
filepath = dir + DEFAULTS_NAME
|
156
84
|
data = Bolt::Util.read_yaml_hash(filepath, 'config')
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
# Warn if 'bolt.yaml' detected in same directory.
|
161
|
-
if File.exist?(bolt_yaml = dir + BOLT_CONFIG_NAME)
|
162
|
-
logs.push(
|
163
|
-
warn: "Detected multiple configuration files: ['#{bolt_yaml}', '#{filepath}']. '#{bolt_yaml}' "\
|
164
|
-
"will be ignored."
|
165
|
-
)
|
166
|
-
end
|
85
|
+
|
86
|
+
Bolt::Logger.debug("Loaded configuration from #{filepath}")
|
167
87
|
|
168
88
|
# Validate the config against the schema. This will raise a single error
|
169
89
|
# with all validation errors.
|
170
90
|
Bolt::Validator.new.tap do |validator|
|
171
91
|
validator.validate(data, defaults_schema, filepath)
|
172
|
-
|
173
|
-
validator.
|
174
|
-
|
175
|
-
validator.deprecations.each do |dep|
|
176
|
-
deprecations << { type: "#{BOLT_DEFAULTS_NAME} #{dep[:option]}", msg: dep[:message] }
|
177
|
-
end
|
92
|
+
validator.warnings.each { |warning| Bolt::Logger.warn(warning[:id], warning[:msg]) }
|
93
|
+
validator.deprecations.each { |dep| Bolt::Logger.deprecate(dep[:id], dep[:msg]) }
|
178
94
|
end
|
179
95
|
|
180
96
|
# Remove project-specific config such as hiera-config, etc.
|
181
|
-
project_config = data.slice(*(
|
97
|
+
project_config = data.slice(*(PROJECT_OPTIONS - DEFAULTS_OPTIONS))
|
182
98
|
|
183
99
|
if project_config.any?
|
184
100
|
data.reject! { |key, _| project_config.include?(key) }
|
185
|
-
|
186
|
-
|
101
|
+
|
102
|
+
Bolt::Logger.warn(
|
103
|
+
"unsupported_project_config",
|
104
|
+
"Unsupported project configuration detected in '#{filepath}': #{project_config.keys}. "\
|
187
105
|
"Project configuration should be set in 'bolt-project.yaml'."
|
188
106
|
)
|
189
107
|
end
|
@@ -193,8 +111,10 @@ module Bolt
|
|
193
111
|
|
194
112
|
if transport_config.any?
|
195
113
|
data.reject! { |key, _| transport_config.include?(key) }
|
196
|
-
|
197
|
-
|
114
|
+
|
115
|
+
Bolt::Logger.warn(
|
116
|
+
"unsupported_inventory_config",
|
117
|
+
"Unsupported inventory configuration detected in '#{filepath}': #{transport_config.keys}. "\
|
198
118
|
"Transport configuration should be set under the 'inventory-config' option or "\
|
199
119
|
"in 'inventory.yaml'."
|
200
120
|
)
|
@@ -219,55 +139,20 @@ module Bolt
|
|
219
139
|
data = data.merge(data.delete('inventory-config'))
|
220
140
|
end
|
221
141
|
|
222
|
-
{ filepath: filepath, data: data
|
223
|
-
end
|
224
|
-
|
225
|
-
# Loads a 'bolt.yaml' file, the legacy configuration file. There's no special munging needed
|
226
|
-
# here since Bolt::Config will just ignore any invalid keys.
|
227
|
-
def self.load_bolt_yaml(dir)
|
228
|
-
filepath = dir + BOLT_CONFIG_NAME
|
229
|
-
data = Bolt::Util.read_yaml_hash(filepath, 'config')
|
230
|
-
logs = [{ debug: "Loaded configuration from #{filepath}" }]
|
231
|
-
deprecations = [{ type: 'Using bolt.yaml for system configuration',
|
232
|
-
msg: "Configuration file #{filepath} is deprecated and will be removed in Bolt 3.0. "\
|
233
|
-
"See https://pup.pt/update-bolt-config for how to update to the latest Bolt practices." }]
|
234
|
-
|
235
|
-
# Validate the config against the schema. This will raise a single error
|
236
|
-
# with all validation errors.
|
237
|
-
Bolt::Validator.new.tap do |validator|
|
238
|
-
validator.validate(data, bolt_schema, filepath)
|
239
|
-
|
240
|
-
validator.warnings.each { |warning| logs << { warn: warning } }
|
241
|
-
|
242
|
-
validator.deprecations.each do |dep|
|
243
|
-
deprecations << { type: "#{BOLT_CONFIG_NAME} #{dep[:option]}", msg: dep[:message] }
|
244
|
-
end
|
245
|
-
end
|
246
|
-
|
247
|
-
{ filepath: filepath, data: data, logs: logs, deprecations: deprecations }
|
142
|
+
{ filepath: filepath, data: data }
|
248
143
|
end
|
249
144
|
|
250
|
-
def self.load_defaults
|
145
|
+
def self.load_defaults
|
251
146
|
confs = []
|
252
147
|
|
253
|
-
# Load system-level config.
|
254
|
-
|
255
|
-
# config file, don't load it a second time.
|
256
|
-
if File.exist?(system_path + BOLT_DEFAULTS_NAME)
|
148
|
+
# Load system-level config.
|
149
|
+
if File.exist?(system_path + DEFAULTS_NAME)
|
257
150
|
confs << load_bolt_defaults_yaml(system_path)
|
258
|
-
elsif File.exist?(system_path + BOLT_CONFIG_NAME) &&
|
259
|
-
(system_path + BOLT_CONFIG_NAME) != project.config_file
|
260
|
-
confs << load_bolt_yaml(system_path)
|
261
151
|
end
|
262
152
|
|
263
|
-
# Load user-level config if there is a homedir.
|
264
|
-
|
265
|
-
|
266
|
-
if File.exist?(user_path + BOLT_DEFAULTS_NAME)
|
267
|
-
confs << load_bolt_defaults_yaml(user_path)
|
268
|
-
elsif File.exist?(user_path + BOLT_CONFIG_NAME)
|
269
|
-
confs << load_bolt_yaml(user_path)
|
270
|
-
end
|
153
|
+
# Load user-level config if there is a homedir.
|
154
|
+
if user_path && File.exist?(user_path + DEFAULTS_NAME)
|
155
|
+
confs << load_bolt_defaults_yaml(user_path)
|
271
156
|
end
|
272
157
|
|
273
158
|
confs
|
@@ -275,33 +160,26 @@ module Bolt
|
|
275
160
|
|
276
161
|
def initialize(project, config_data, overrides = {})
|
277
162
|
unless config_data.is_a?(Array)
|
278
|
-
config_data = [{ filepath: project.
|
279
|
-
data: config_data,
|
280
|
-
logs: [],
|
281
|
-
deprecations: [] }]
|
163
|
+
config_data = [{ filepath: project.project_file, data: config_data }]
|
282
164
|
end
|
283
165
|
|
284
166
|
@logger = Bolt::Logger.logger(self)
|
285
167
|
@project = project
|
286
|
-
@logs = @project.logs.dup
|
287
|
-
@deprecations = @project.deprecations.dup
|
288
168
|
@transports = {}
|
289
169
|
@config_files = []
|
290
170
|
|
291
171
|
default_data = {
|
292
172
|
'apply-settings' => {},
|
293
|
-
'apply_settings' => {},
|
294
173
|
'color' => true,
|
295
174
|
'compile-concurrency' => Etc.nprocessors,
|
296
175
|
'concurrency' => default_concurrency,
|
176
|
+
'disable-warnings' => [],
|
297
177
|
'format' => 'human',
|
298
178
|
'log' => { 'console' => {} },
|
299
179
|
'module-install' => {},
|
300
180
|
'plugin-hooks' => {},
|
301
|
-
'plugin_hooks' => {},
|
302
181
|
'plugins' => {},
|
303
182
|
'puppetdb' => {},
|
304
|
-
'puppetfile' => {},
|
305
183
|
'save-rerun' => true,
|
306
184
|
'spinner' => true,
|
307
185
|
'transport' => 'ssh'
|
@@ -315,9 +193,6 @@ module Bolt
|
|
315
193
|
end
|
316
194
|
|
317
195
|
loaded_data = config_data.each_with_object([]) do |data, acc|
|
318
|
-
@logs.concat(data[:logs]) if data[:logs].any?
|
319
|
-
@deprecations.concat(data[:deprecations]) if data[:deprecations].any?
|
320
|
-
|
321
196
|
if data[:data].any?
|
322
197
|
@config_files.push(data[:filepath])
|
323
198
|
acc.push(data[:data])
|
@@ -347,28 +222,25 @@ module Bolt
|
|
347
222
|
def normalize_overrides(options)
|
348
223
|
opts = options.transform_keys(&:to_s)
|
349
224
|
|
350
|
-
# Pull out config options. We need to add 'transport'
|
351
|
-
# OPTIONS hash but
|
352
|
-
overrides = opts.slice(*OPTIONS.keys, 'transport')
|
225
|
+
# Pull out config options. We need to add 'transport' and 'inventoryfile' as they're
|
226
|
+
# not part of the OPTIONS hash but are valid options that can be set with CLI options
|
227
|
+
overrides = opts.slice(*OPTIONS.keys, 'inventoryfile', 'transport')
|
353
228
|
|
354
229
|
# Pull out transport config options
|
355
230
|
TRANSPORT_CONFIG.each do |transport, config|
|
356
231
|
overrides[transport] = opts.slice(*config.options)
|
357
232
|
end
|
358
233
|
|
359
|
-
# Set console log to debug if in debug mode
|
360
|
-
if options[:debug]
|
361
|
-
overrides['log'] = { 'console' => { 'level' => 'debug' } }
|
362
|
-
end
|
363
|
-
|
364
|
-
if options[:puppetfile_path]
|
365
|
-
@puppetfile = options[:puppetfile_path]
|
366
|
-
end
|
367
|
-
|
368
234
|
overrides['trace'] = opts['trace'] if opts.key?('trace')
|
369
235
|
|
370
|
-
# Validate the overrides
|
371
|
-
|
236
|
+
# Validate the overrides that can have arbitrary values
|
237
|
+
schema = {
|
238
|
+
type: Hash,
|
239
|
+
properties: CLI_OPTIONS.map { |opt| [opt, _ref: opt] }.to_h,
|
240
|
+
definitions: OPTIONS.merge(INVENTORY_OPTIONS)
|
241
|
+
}
|
242
|
+
|
243
|
+
Bolt::Validator.new.validate(overrides.slice(*CLI_OPTIONS), schema, 'command line')
|
372
244
|
|
373
245
|
overrides
|
374
246
|
end
|
@@ -386,8 +258,11 @@ module Bolt
|
|
386
258
|
when *TRANSPORT_CONFIG.keys
|
387
259
|
Bolt::Util.deep_merge(val1, val2)
|
388
260
|
# Hash values are shallow merged
|
389
|
-
when '
|
261
|
+
when 'apply-settings', 'log', 'plugin-hooks', 'puppetdb'
|
390
262
|
val1.merge(val2)
|
263
|
+
# Disabled warnings are concatenated
|
264
|
+
when 'disable-warnings'
|
265
|
+
val1.concat(val2)
|
391
266
|
# All other values are overwritten
|
392
267
|
else
|
393
268
|
val2
|
@@ -423,7 +298,7 @@ module Bolt
|
|
423
298
|
end
|
424
299
|
|
425
300
|
# Filter hashes to only include valid options
|
426
|
-
%w[apply-settings
|
301
|
+
%w[apply-settings module-install].each do |opt|
|
427
302
|
@data[opt] = @data[opt].slice(*OPTIONS.dig(opt, :properties).keys)
|
428
303
|
end
|
429
304
|
end
|
@@ -449,23 +324,18 @@ module Bolt
|
|
449
324
|
|
450
325
|
name = normalize_log(key)
|
451
326
|
acc[name] = val.slice('append', 'level').transform_keys(&:to_sym)
|
452
|
-
|
453
|
-
next unless acc[name][:level] == 'notice'
|
454
|
-
|
455
|
-
@deprecations << {
|
456
|
-
type: 'notice log level',
|
457
|
-
msg: "Log level 'notice' is deprecated and will be removed in Bolt 3.0. Use 'info' instead."
|
458
|
-
}
|
459
327
|
end
|
460
328
|
end
|
461
329
|
|
462
330
|
def validate
|
463
331
|
if @data['future']
|
464
|
-
|
465
|
-
|
332
|
+
Bolt::Logger.warn(
|
333
|
+
"future_option",
|
334
|
+
"Configuration option 'future' no longer exposes future behavior."
|
335
|
+
)
|
466
336
|
end
|
467
337
|
|
468
|
-
if @
|
338
|
+
if @data['modulepath']&.include?(@project.managed_moduledir.to_s)
|
469
339
|
raise Bolt::ValidationError,
|
470
340
|
"Found invalid path in modulepath: #{@project.managed_moduledir}. This path "\
|
471
341
|
"is automatically appended to the modulepath and cannot be configured."
|
@@ -483,25 +353,6 @@ module Bolt
|
|
483
353
|
if File.exist?(default_inventoryfile)
|
484
354
|
Bolt::Util.validate_file('inventory file', default_inventoryfile)
|
485
355
|
end
|
486
|
-
|
487
|
-
# Warn the user how they should be using the 'puppetfile' or
|
488
|
-
# 'module-install' config options. We don't error here since these
|
489
|
-
# settings can be set at the user or system level.
|
490
|
-
if @project.modules && puppetfile_config.any? && module_install.empty?
|
491
|
-
command = Bolt::Util.powershell? ? 'Update-BoltProject' : 'bolt project migrate'
|
492
|
-
@logs << { warn: "Detected configuration for 'puppetfile'. This setting is not "\
|
493
|
-
"used when 'modules' is configured. Use 'module-install' instead. "\
|
494
|
-
"To automatically update your project configuration, run '#{command}'." }
|
495
|
-
elsif @project.modules.nil? && puppetfile_config.empty? && module_install.any?
|
496
|
-
@logs << { warn: "Detected configuration for 'module-install'. This setting is not "\
|
497
|
-
"used when 'modules' is not configured. Use 'puppetfile' instead." }
|
498
|
-
elsif @project.modules && puppetfile_config.any? && module_install.any?
|
499
|
-
@logs << { warn: "Detected configuration for 'puppetfile' and 'module-install'. Using "\
|
500
|
-
"configuration for 'module-install' because 'modules' is also configured." }
|
501
|
-
elsif @project.modules.nil? && puppetfile_config.any? && module_install.any?
|
502
|
-
@logs << { warn: "Detected configuration for 'puppetfile' and 'module-install'. Using "\
|
503
|
-
"configuration for 'puppetfile' because 'modules' is not configured." }
|
504
|
-
end
|
505
356
|
end
|
506
357
|
|
507
358
|
def default_inventoryfile
|
@@ -517,21 +368,15 @@ module Bolt
|
|
517
368
|
end
|
518
369
|
|
519
370
|
def puppetfile
|
520
|
-
@
|
371
|
+
@project.puppetfile
|
521
372
|
end
|
522
373
|
|
523
374
|
def modulepath
|
524
|
-
|
525
|
-
|
526
|
-
if @project.modules
|
527
|
-
path + [@project.managed_moduledir.to_s]
|
528
|
-
else
|
529
|
-
path
|
530
|
-
end
|
375
|
+
(@data['modulepath'] || @project.modulepath) + [@project.managed_moduledir.to_s]
|
531
376
|
end
|
532
377
|
|
533
378
|
def modulepath=(value)
|
534
|
-
@data['modulepath'] = value
|
379
|
+
@data['modulepath'] = Array(value)
|
535
380
|
end
|
536
381
|
|
537
382
|
def plugin_cache
|
@@ -574,6 +419,10 @@ module Bolt
|
|
574
419
|
@data['spinner']
|
575
420
|
end
|
576
421
|
|
422
|
+
def stream
|
423
|
+
@data['stream']
|
424
|
+
end
|
425
|
+
|
577
426
|
def inventoryfile
|
578
427
|
@data['inventoryfile']
|
579
428
|
end
|
@@ -582,27 +431,12 @@ module Bolt
|
|
582
431
|
@data['compile-concurrency']
|
583
432
|
end
|
584
433
|
|
585
|
-
def puppetfile_config
|
586
|
-
@data['puppetfile']
|
587
|
-
end
|
588
|
-
|
589
434
|
def plugins
|
590
435
|
@data['plugins']
|
591
436
|
end
|
592
437
|
|
593
438
|
def plugin_hooks
|
594
|
-
|
595
|
-
Bolt::Logger.warn_once(
|
596
|
-
"plugin-hooks and plugin_hooks set",
|
597
|
-
"Detected configuration for 'plugin-hooks' and 'plugin_hooks'. Bolt will ignore 'plugin_hooks'."
|
598
|
-
)
|
599
|
-
|
600
|
-
@data['plugin-hooks']
|
601
|
-
elsif @data['plugin-hooks'].any?
|
602
|
-
@data['plugin-hooks']
|
603
|
-
else
|
604
|
-
@data['plugin_hooks']
|
605
|
-
end
|
439
|
+
@data['plugin-hooks']
|
606
440
|
end
|
607
441
|
|
608
442
|
def trusted_external
|
@@ -610,18 +444,7 @@ module Bolt
|
|
610
444
|
end
|
611
445
|
|
612
446
|
def apply_settings
|
613
|
-
|
614
|
-
Bolt::Logger.warn_once(
|
615
|
-
"apply-settings and apply_settings set",
|
616
|
-
"Detected configuration for 'apply-settings' and 'apply_settings'. Bolt will ignore 'apply_settings'."
|
617
|
-
)
|
618
|
-
|
619
|
-
@data['apply-settings']
|
620
|
-
elsif @data['apply-settings'].any?
|
621
|
-
@data['apply-settings']
|
622
|
-
else
|
623
|
-
@data['apply_settings']
|
624
|
-
end
|
447
|
+
@data['apply-settings']
|
625
448
|
end
|
626
449
|
|
627
450
|
def transport
|
@@ -632,6 +455,10 @@ module Bolt
|
|
632
455
|
@project.module_install || @data['module-install']
|
633
456
|
end
|
634
457
|
|
458
|
+
def disable_warnings
|
459
|
+
Set.new(@project.disable_warnings + @data['disable-warnings'])
|
460
|
+
end
|
461
|
+
|
635
462
|
# Check if there is a case-insensitive match to the path
|
636
463
|
def check_path_case(type, paths)
|
637
464
|
return if paths.nil?
|
@@ -640,7 +467,7 @@ module Bolt
|
|
640
467
|
if matches.any?
|
641
468
|
msg = "WARNING: Bolt is case sensitive when specifying a #{type}. Did you mean:\n"
|
642
469
|
matches.each { |path| msg += " #{path}\n" }
|
643
|
-
|
470
|
+
Bolt::Logger.warn("path_case", msg)
|
644
471
|
end
|
645
472
|
end
|
646
473
|
|