bolt 2.34.0 → 2.40.1
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 +1 -1
- data/bolt-modules/boltlib/lib/puppet/datatypes/applyresult.rb +1 -0
- data/bolt-modules/boltlib/lib/puppet/functions/catch_errors.rb +1 -3
- data/bolt-modules/boltlib/lib/puppet/functions/download_file.rb +17 -6
- data/bolt-modules/boltlib/lib/puppet/functions/parallelize.rb +56 -0
- data/bolt-modules/boltlib/lib/puppet/functions/run_command.rb +24 -6
- data/bolt-modules/boltlib/lib/puppet/functions/run_script.rb +27 -8
- data/bolt-modules/boltlib/lib/puppet/functions/run_task.rb +21 -1
- data/bolt-modules/boltlib/lib/puppet/functions/run_task_with.rb +18 -1
- data/bolt-modules/boltlib/lib/puppet/functions/upload_file.rb +24 -6
- data/lib/bolt/analytics.rb +27 -8
- data/lib/bolt/apply_result.rb +3 -3
- data/lib/bolt/bolt_option_parser.rb +45 -18
- data/lib/bolt/cli.rb +98 -116
- data/lib/bolt/config.rb +184 -80
- data/lib/bolt/config/options.rb +148 -87
- data/lib/bolt/config/transport/base.rb +10 -19
- data/lib/bolt/config/transport/local.rb +1 -7
- data/lib/bolt/config/transport/options.rb +12 -69
- data/lib/bolt/config/transport/ssh.rb +8 -19
- data/lib/bolt/error.rb +24 -0
- data/lib/bolt/executor.rb +92 -18
- data/lib/bolt/inventory.rb +25 -0
- data/lib/bolt/inventory/group.rb +0 -8
- data/lib/bolt/inventory/options.rb +130 -0
- data/lib/bolt/inventory/target.rb +10 -11
- data/lib/bolt/module_installer.rb +21 -13
- data/lib/bolt/module_installer/resolver.rb +1 -1
- data/lib/bolt/outputter.rb +19 -5
- data/lib/bolt/outputter/human.rb +22 -3
- data/lib/bolt/outputter/json.rb +1 -1
- data/lib/bolt/outputter/logger.rb +1 -1
- data/lib/bolt/outputter/rainbow.rb +13 -2
- data/lib/bolt/pal.rb +18 -6
- data/lib/bolt/pal/yaml_plan.rb +7 -0
- data/lib/bolt/plugin.rb +41 -12
- data/lib/bolt/plugin/cache.rb +76 -0
- data/lib/bolt/plugin/module.rb +4 -4
- data/lib/bolt/plugin/puppetdb.rb +1 -1
- data/lib/bolt/project.rb +59 -40
- data/lib/bolt/project_manager.rb +201 -0
- data/lib/bolt/{project_migrator/config.rb → project_manager/config_migrator.rb} +49 -4
- data/lib/bolt/{project_migrator/inventory.rb → project_manager/inventory_migrator.rb} +3 -3
- data/lib/bolt/{project_migrator/base.rb → project_manager/migrator.rb} +2 -2
- data/lib/bolt/{project_migrator/modules.rb → project_manager/module_migrator.rb} +5 -3
- data/lib/bolt/puppetdb/client.rb +11 -2
- data/lib/bolt/puppetdb/config.rb +4 -3
- data/lib/bolt/rerun.rb +1 -5
- data/lib/bolt/shell/bash.rb +8 -2
- data/lib/bolt/shell/powershell.rb +21 -3
- data/lib/bolt/target.rb +4 -0
- data/lib/bolt/task/run.rb +1 -1
- data/lib/bolt/transport/local.rb +13 -0
- data/lib/bolt/transport/orch.rb +0 -5
- data/lib/bolt/transport/orch/connection.rb +10 -3
- data/lib/bolt/transport/ssh/exec_connection.rb +6 -2
- data/lib/bolt/util.rb +36 -7
- data/lib/bolt/validator.rb +227 -0
- data/lib/bolt/version.rb +1 -1
- data/lib/bolt/yarn.rb +23 -0
- data/lib/bolt_server/base_config.rb +3 -1
- data/lib/bolt_server/config.rb +3 -1
- data/lib/bolt_server/plugin.rb +13 -0
- data/lib/bolt_server/plugin/puppet_connect_data.rb +37 -0
- data/lib/bolt_server/schemas/connect-data.json +22 -0
- data/lib/bolt_server/schemas/partials/task.json +2 -2
- data/lib/bolt_server/transport_app.rb +82 -23
- data/lib/bolt_spec/plans/mock_executor.rb +4 -1
- data/libexec/apply_catalog.rb +1 -1
- data/libexec/custom_facts.rb +1 -1
- data/libexec/query_resources.rb +1 -1
- metadata +22 -14
- data/lib/bolt/project_migrator.rb +0 -80
data/lib/bolt/config/options.rb
CHANGED
@@ -33,77 +33,42 @@ module Bolt
|
|
33
33
|
"_plugin" => {
|
34
34
|
description: "The name of the plugin.",
|
35
35
|
type: "string"
|
36
|
+
},
|
37
|
+
"_cache" => {
|
38
|
+
description: "This feature is experimental. Enable plugin caching and set a time-to-live.",
|
39
|
+
type: "object",
|
40
|
+
required: ["ttl"],
|
41
|
+
properties: {
|
42
|
+
"ttl" => {
|
43
|
+
description: "Time in seconds to keep the plugin cache.",
|
44
|
+
type: "integer",
|
45
|
+
minimum: 0
|
46
|
+
}
|
47
|
+
}
|
36
48
|
}
|
37
49
|
}
|
38
50
|
}
|
39
51
|
}.freeze
|
40
52
|
|
41
|
-
#
|
42
|
-
#
|
43
|
-
# option's definition. These options are used in multiple locations:
|
44
|
-
#
|
45
|
-
# - Automatic type validation when loading and setting configuration
|
46
|
-
# - Generating reference documentation for configuration files
|
47
|
-
# - Generating JSON schemas for configuration files
|
48
|
-
#
|
49
|
-
# Data includes keys defined by JSON Schema Draft 07 as well as some metadata used
|
50
|
-
# by Bolt to generate documentation. The following keys are used:
|
51
|
-
#
|
52
|
-
# :description String A detailed description of the option and what it does. This
|
53
|
-
# field is used in both documentation and the JSON schemas,
|
54
|
-
# and should provide as much detail as possible, including
|
55
|
-
# links to relevant documentation.
|
56
|
-
#
|
57
|
-
# :type Class The expected type of a value. These should be Ruby classes,
|
58
|
-
# as this field is used to perform automatic type validation.
|
59
|
-
# If an option can accept more than one type, this should be
|
60
|
-
# an array of types. Boolean values should set :type to
|
61
|
-
# [TrueClass, FalseClass], as Ruby does not have a single
|
62
|
-
# Boolean class.
|
63
|
-
#
|
64
|
-
# :items Hash A definition hash for items in an array. Similar to values
|
65
|
-
# for top-level options, items can have a :description, :type,
|
66
|
-
# or any other key in this list.
|
67
|
-
#
|
68
|
-
# :uniqueItems Boolean Whether or not an array should contain only unique items.
|
69
|
-
#
|
70
|
-
# :properties Hash A hash where keys are sub-options and values are definitions
|
71
|
-
# for the sub-option. Similar to values for top-level options,
|
72
|
-
# properties can have a :description, :type, or any other key
|
73
|
-
# in this list.
|
74
|
-
#
|
75
|
-
# :additionalProperties A variation of the :properties key, where the hash is a
|
76
|
-
# Hash definition for any properties not specified in :properties.
|
77
|
-
# This can be used to permit arbitrary sub-options, such as
|
78
|
-
# logs for the 'log' option.
|
79
|
-
#
|
80
|
-
# :required Array An array of properties that are required for options that
|
81
|
-
# accept Hash values.
|
82
|
-
#
|
83
|
-
# :minimum Integer The minimum integer value for an option.
|
84
|
-
#
|
85
|
-
# :enum Array An array of values that the option recognizes.
|
86
|
-
#
|
87
|
-
# :pattern String A JSON regex pattern that the option's vaue should match.
|
88
|
-
#
|
89
|
-
# :format String Requires that a string value matches a format defined by the
|
90
|
-
# JSON Schema draft.
|
91
|
-
#
|
92
|
-
# :_plugin Boolean Whether the option accepts a plugin reference. This is used
|
93
|
-
# when generating the JSON schemas to determine whether or not
|
94
|
-
# to include a reference to the _plugin definition. If :_plugin
|
95
|
-
# is set to true, the script that generates JSON schemas will
|
96
|
-
# automatically recurse through the :items and :properties keys
|
97
|
-
# and add plugin references if applicable.
|
98
|
-
#
|
99
|
-
# :_example Any An example value for the option. This is used to generate
|
100
|
-
# reference documentation for configuration files.
|
101
|
-
#
|
102
|
-
# :_default Any The documented default value for the option. This is only
|
103
|
-
# used to generate reference documentation for configuration
|
104
|
-
# files and is not used by Bolt to actually set default values.
|
53
|
+
# Definitions used to validate config options.
|
54
|
+
# https://github.com/puppetlabs/bolt/blob/main/schemas/README.md
|
105
55
|
OPTIONS = {
|
106
56
|
"apply_settings" => {
|
57
|
+
description: "A map of Puppet settings to use when applying Puppet code using the `apply` "\
|
58
|
+
"plan function or the `bolt apply` command.",
|
59
|
+
type: Hash,
|
60
|
+
properties: {
|
61
|
+
"show_diff" => {
|
62
|
+
description: "Whether to log and report a contextual diff.",
|
63
|
+
type: [TrueClass, FalseClass],
|
64
|
+
_example: true,
|
65
|
+
_default: false
|
66
|
+
}
|
67
|
+
},
|
68
|
+
_plugin: false,
|
69
|
+
_deprecation: "This option will be removed in Bolt 3.0. Use `apply-settings` instead."
|
70
|
+
},
|
71
|
+
"apply-settings" => {
|
107
72
|
description: "A map of Puppet settings to use when applying Puppet code using the `apply` "\
|
108
73
|
"plan function or the `bolt apply` command.",
|
109
74
|
type: Hash,
|
@@ -169,9 +134,26 @@ module Bolt
|
|
169
134
|
"files](inventory_file_v2.md).",
|
170
135
|
type: String,
|
171
136
|
_plugin: false,
|
137
|
+
_deprecation: "This option will be removed in Bolt 3.0. Use the `--inventoryfile` command-line option "\
|
138
|
+
"to use a non-default inventory file or move the file contents to `inventory.yaml` in the "\
|
139
|
+
"project directory.",
|
172
140
|
_example: "~/.puppetlabs/bolt/inventory.yaml",
|
173
141
|
_default: "project/inventory.yaml"
|
174
142
|
},
|
143
|
+
"plugin-cache" => {
|
144
|
+
description: "This feature is experimental. Enable plugin caching and set the time-to-live.",
|
145
|
+
type: Hash,
|
146
|
+
required: ["ttl"],
|
147
|
+
properties: {
|
148
|
+
"ttl" => {
|
149
|
+
description: "Time in seconds to keep the plugin cache.",
|
150
|
+
type: Integer,
|
151
|
+
minimum: 0
|
152
|
+
}
|
153
|
+
},
|
154
|
+
_plugin: false,
|
155
|
+
_example: { "ttl" => 3600 }
|
156
|
+
},
|
175
157
|
"log" => {
|
176
158
|
description: "A map of configuration for the logfile output. Under `log`, you can configure log options "\
|
177
159
|
"for `console` and add configuration for individual log files, such as "\
|
@@ -183,12 +165,13 @@ module Bolt
|
|
183
165
|
properties: {
|
184
166
|
"console" => {
|
185
167
|
description: "Configuration for logs output to the console.",
|
186
|
-
type: Hash,
|
168
|
+
type: [String, Hash],
|
169
|
+
enum: ['disable'],
|
187
170
|
properties: {
|
188
171
|
"level" => {
|
189
172
|
description: "The type of information to log.",
|
190
173
|
type: String,
|
191
|
-
enum: %w[trace debug error info warn fatal any],
|
174
|
+
enum: %w[trace debug error info notice warn fatal any],
|
192
175
|
_default: "warn"
|
193
176
|
}
|
194
177
|
}
|
@@ -207,7 +190,7 @@ module Bolt
|
|
207
190
|
"level" => {
|
208
191
|
description: "The type of information to log.",
|
209
192
|
type: String,
|
210
|
-
enum: %w[trace debug error info warn fatal any],
|
193
|
+
enum: %w[trace debug error info notice warn fatal any],
|
211
194
|
_default: "warn"
|
212
195
|
}
|
213
196
|
}
|
@@ -227,6 +210,41 @@ module Bolt
|
|
227
210
|
_example: ["~/.puppetlabs/bolt/modules", "~/.puppetlabs/bolt/site-modules"],
|
228
211
|
_default: ["project/modules", "project/site-modules", "project/site"]
|
229
212
|
},
|
213
|
+
"module-install" => {
|
214
|
+
description: "Options that configure where Bolt downloads modules from. This option is only used when "\
|
215
|
+
"installing modules using the `bolt module add|install` commands and "\
|
216
|
+
"`Add|Install-BoltModule` cmdlets.",
|
217
|
+
type: Hash,
|
218
|
+
properties: {
|
219
|
+
"forge" => {
|
220
|
+
description: "A subsection that can have its own `proxy` setting to set an HTTP proxy for Forge "\
|
221
|
+
"operations only, and a `baseurl` setting to specify a different Forge host.",
|
222
|
+
type: Hash,
|
223
|
+
properties: {
|
224
|
+
"baseurl" => {
|
225
|
+
description: "The URL to the Forge host.",
|
226
|
+
type: String,
|
227
|
+
format: "uri",
|
228
|
+
_example: "https://forge.example.com"
|
229
|
+
},
|
230
|
+
"proxy" => {
|
231
|
+
description: "The HTTP proxy to use for Forge operations.",
|
232
|
+
type: String,
|
233
|
+
format: "uri",
|
234
|
+
_example: "https://my-forge-proxy.com:8080"
|
235
|
+
}
|
236
|
+
},
|
237
|
+
_example: { "baseurl" => "https://forge.example.com", "proxy" => "https://my-forge-proxy.com:8080" }
|
238
|
+
},
|
239
|
+
"proxy" => {
|
240
|
+
description: "The HTTP proxy to use for Git and Forge operations.",
|
241
|
+
type: String,
|
242
|
+
format: "uri",
|
243
|
+
_example: "https://my-proxy.com:8080"
|
244
|
+
}
|
245
|
+
},
|
246
|
+
_plugin: false
|
247
|
+
},
|
230
248
|
"modules" => {
|
231
249
|
description: "A list of module dependencies for the project. Each dependency is a map of data specifying "\
|
232
250
|
"the module to install. To install the project's module dependencies, run the `bolt module "\
|
@@ -276,14 +294,14 @@ module Bolt
|
|
276
294
|
},
|
277
295
|
"name" => {
|
278
296
|
description: "The name of the Bolt project. When this option is configured, the project is considered a "\
|
279
|
-
"[Bolt project](
|
280
|
-
"
|
297
|
+
"[Bolt project](projects.md), allowing Bolt to load content from the project directory "\
|
298
|
+
"as though it were a module.",
|
281
299
|
type: String,
|
282
300
|
_plugin: false,
|
283
301
|
_example: "myproject"
|
284
302
|
},
|
285
303
|
"plans" => {
|
286
|
-
description: "A list of plan names
|
304
|
+
description: "A list of plan names and glob patterns to filter the project's plans by. This option is used "\
|
287
305
|
"to limit the visibility of plans for users of the project. For example, project authors "\
|
288
306
|
"might want to limit the visibility of plans that are bundled with Bolt or plans that should "\
|
289
307
|
"only be run as part of another plan. When this option is not configured, all plans are "\
|
@@ -291,9 +309,19 @@ module Bolt
|
|
291
309
|
"list.",
|
292
310
|
type: Array,
|
293
311
|
_plugin: false,
|
294
|
-
_example: ["myproject", "myproject::foo", "myproject::bar"]
|
312
|
+
_example: ["myproject", "myproject::foo", "myproject::bar", "myproject::deploy::*"]
|
295
313
|
},
|
296
314
|
"plugin_hooks" => {
|
315
|
+
description: "A map of [plugin hooks](writing_plugins.md#hooks) and which plugins a hook should use. "\
|
316
|
+
"The only configurable plugin hook is `puppet_library`, which can use two possible plugins: "\
|
317
|
+
"[`puppet_agent`](https://github.com/puppetlabs/puppetlabs-puppet_agent#puppet_agentinstall) "\
|
318
|
+
"and [`task`](using_plugins.md#task).",
|
319
|
+
type: Hash,
|
320
|
+
_plugin: true,
|
321
|
+
_example: { "puppet_library" => { "plugin" => "puppet_agent", "version" => "6.15.0", "_run_as" => "root" } },
|
322
|
+
_deprecation: "This option will be removed in Bolt 3.0. Use `plugin-hooks` instead."
|
323
|
+
},
|
324
|
+
"plugin-hooks" => {
|
297
325
|
description: "A map of [plugin hooks](writing_plugins.md#hooks) and which plugins a hook should use. "\
|
298
326
|
"The only configurable plugin hook is `puppet_library`, which can use two possible plugins: "\
|
299
327
|
"[`puppet_agent`](https://github.com/puppetlabs/puppetlabs-puppet_agent#puppet_agentinstall) "\
|
@@ -307,7 +335,11 @@ module Bolt
|
|
307
335
|
"its value is a map of configuration data. Configurable options are specified by the plugin. "\
|
308
336
|
"Read more about configuring plugins in [Using plugins](using_plugins.md#configuring-plugins).",
|
309
337
|
type: Hash,
|
310
|
-
|
338
|
+
additionalProperties: {
|
339
|
+
type: Hash,
|
340
|
+
_plugin: true
|
341
|
+
},
|
342
|
+
_plugin: false,
|
311
343
|
_example: { "pkcs7" => { "keysize" => 1024 } }
|
312
344
|
},
|
313
345
|
"puppetdb" => {
|
@@ -318,49 +350,57 @@ module Bolt
|
|
318
350
|
"cacert" => {
|
319
351
|
description: "The path to the ca certificate for PuppetDB.",
|
320
352
|
type: String,
|
321
|
-
_example: "/etc/puppetlabs/puppet/ssl/certs/ca.pem"
|
353
|
+
_example: "/etc/puppetlabs/puppet/ssl/certs/ca.pem",
|
354
|
+
_plugin: true
|
322
355
|
},
|
323
356
|
"cert" => {
|
324
357
|
description: "The path to the client certificate file to use for authentication.",
|
325
358
|
type: String,
|
326
|
-
_example: "/etc/puppetlabs/puppet/ssl/certs/my-host.example.com.pem"
|
359
|
+
_example: "/etc/puppetlabs/puppet/ssl/certs/my-host.example.com.pem",
|
360
|
+
_plugin: true
|
327
361
|
},
|
328
362
|
"connect_timeout" => {
|
329
363
|
description: "How long to wait in seconds when establishing connections with PuppetDB.",
|
330
364
|
type: Integer,
|
331
365
|
minimum: 1,
|
332
366
|
_default: 60,
|
333
|
-
_example: 120
|
367
|
+
_example: 120,
|
368
|
+
_plugin: true
|
334
369
|
},
|
335
370
|
"key" => {
|
336
371
|
description: "The private key for the certificate.",
|
337
372
|
type: String,
|
338
|
-
_example: "/etc/puppetlabs/puppet/ssl/private_keys/my-host.example.com.pem"
|
373
|
+
_example: "/etc/puppetlabs/puppet/ssl/private_keys/my-host.example.com.pem",
|
374
|
+
_plugin: true
|
339
375
|
},
|
340
376
|
"read_timeout" => {
|
341
377
|
description: "How long to wait in seconds for a response from PuppetDB.",
|
342
378
|
type: Integer,
|
343
379
|
minimum: 1,
|
344
380
|
_default: 60,
|
345
|
-
_example: 120
|
381
|
+
_example: 120,
|
382
|
+
_plugin: true
|
346
383
|
},
|
347
384
|
"server_urls" => {
|
348
385
|
description: "An array containing the PuppetDB host to connect to. Include the protocol `https` "\
|
349
386
|
"and the port, which is usually `8081`. For example, "\
|
350
387
|
"`https://my-puppetdb-server.com:8081`.",
|
351
388
|
type: Array,
|
352
|
-
_example: ["https://puppet.example.com:8081"]
|
389
|
+
_example: ["https://puppet.example.com:8081"],
|
390
|
+
_plugin: true
|
353
391
|
},
|
354
392
|
"token" => {
|
355
393
|
description: "The path to the PE RBAC Token.",
|
356
394
|
type: String,
|
357
|
-
_example: "~/.puppetlabs/token"
|
395
|
+
_example: "~/.puppetlabs/token",
|
396
|
+
_plugin: true
|
358
397
|
}
|
359
398
|
},
|
360
399
|
_plugin: true
|
361
400
|
},
|
362
401
|
"puppetfile" => {
|
363
|
-
description: "A map containing options for the `bolt puppetfile install` command
|
402
|
+
description: "A map containing options for the `bolt puppetfile install` command and "\
|
403
|
+
"`Install-BoltPuppetfile` cmdlet.",
|
364
404
|
type: Hash,
|
365
405
|
properties: {
|
366
406
|
"forge" => {
|
@@ -375,19 +415,19 @@ module Bolt
|
|
375
415
|
_example: "https://forge.example.com"
|
376
416
|
},
|
377
417
|
"proxy" => {
|
378
|
-
description: "The HTTP proxy to use for
|
418
|
+
description: "The HTTP proxy to use for Forge operations.",
|
379
419
|
type: String,
|
380
420
|
format: "uri",
|
381
|
-
_example: "https://
|
421
|
+
_example: "https://my-forge-proxy.com:8080"
|
382
422
|
}
|
383
423
|
},
|
384
|
-
_example: { "baseurl" => "https://forge.example.com", "proxy" => "https://
|
424
|
+
_example: { "baseurl" => "https://forge.example.com", "proxy" => "https://my-forge-proxy.com:8080" }
|
385
425
|
},
|
386
426
|
"proxy" => {
|
387
427
|
description: "The HTTP proxy to use for Git and Forge operations.",
|
388
428
|
type: String,
|
389
429
|
format: "uri",
|
390
|
-
_example: "https://
|
430
|
+
_example: "https://my-proxy.com:8080"
|
391
431
|
}
|
392
432
|
},
|
393
433
|
_plugin: false
|
@@ -401,8 +441,16 @@ module Bolt
|
|
401
441
|
_example: false,
|
402
442
|
_default: true
|
403
443
|
},
|
444
|
+
"spinner" => {
|
445
|
+
description: "Whether to print a spinner to the console for long-running Bolt operations.",
|
446
|
+
type: [TrueClass, FalseClass],
|
447
|
+
_plugin: false,
|
448
|
+
_example: false,
|
449
|
+
_default: true
|
450
|
+
},
|
451
|
+
|
404
452
|
"tasks" => {
|
405
|
-
description: "A list of task names
|
453
|
+
description: "A list of task names and glob patterns to filter the project's tasks by. This option is used "\
|
406
454
|
"to limit the visibility of tasks for users of the project. For example, project authors "\
|
407
455
|
"might want to limit the visibility of tasks that are bundled with Bolt or plans that should "\
|
408
456
|
"only be run as part of a larger workflow. When this option is not configured, all tasks "\
|
@@ -413,7 +461,7 @@ module Bolt
|
|
413
461
|
type: String
|
414
462
|
},
|
415
463
|
_plugin: false,
|
416
|
-
_example: ["myproject", "myproject::foo", "myproject::bar"]
|
464
|
+
_example: ["myproject", "myproject::foo", "myproject::bar", "myproject::deploy_*"]
|
417
465
|
},
|
418
466
|
"trusted-external-command" => {
|
419
467
|
description: "The path to an executable on the Bolt controller that can produce external trusted facts. "\
|
@@ -435,7 +483,7 @@ module Bolt
|
|
435
483
|
"specified in the URI.",
|
436
484
|
type: String,
|
437
485
|
enum: TRANSPORT_CONFIG.keys,
|
438
|
-
_plugin:
|
486
|
+
_plugin: true,
|
439
487
|
_example: "winrm",
|
440
488
|
_default: "ssh"
|
441
489
|
},
|
@@ -461,6 +509,7 @@ module Bolt
|
|
461
509
|
"remote" => {
|
462
510
|
description: "A map of configuration options for the remote transport.",
|
463
511
|
type: Hash,
|
512
|
+
additionalProperties: true,
|
464
513
|
_plugin: true,
|
465
514
|
_example: { "run-on" => "proxy_target" }
|
466
515
|
},
|
@@ -480,6 +529,7 @@ module Bolt
|
|
480
529
|
|
481
530
|
# Options that are available in a bolt.yaml file
|
482
531
|
BOLT_OPTIONS = %w[
|
532
|
+
apply-settings
|
483
533
|
apply_settings
|
484
534
|
color
|
485
535
|
compile-concurrency
|
@@ -489,11 +539,13 @@ module Bolt
|
|
489
539
|
inventoryfile
|
490
540
|
log
|
491
541
|
modulepath
|
542
|
+
plugin-hooks
|
492
543
|
plugin_hooks
|
493
544
|
plugins
|
494
545
|
puppetdb
|
495
546
|
puppetfile
|
496
547
|
save-rerun
|
548
|
+
spinner
|
497
549
|
trusted-external-command
|
498
550
|
].freeze
|
499
551
|
|
@@ -505,15 +557,20 @@ module Bolt
|
|
505
557
|
format
|
506
558
|
inventory-config
|
507
559
|
log
|
560
|
+
module-install
|
561
|
+
plugin-cache
|
562
|
+
plugin-hooks
|
508
563
|
plugin_hooks
|
509
564
|
plugins
|
510
565
|
puppetdb
|
511
566
|
puppetfile
|
512
567
|
save-rerun
|
568
|
+
spinner
|
513
569
|
].freeze
|
514
570
|
|
515
571
|
# Options that are available in a bolt-project.yaml file
|
516
572
|
BOLT_PROJECT_OPTIONS = %w[
|
573
|
+
apply-settings
|
517
574
|
apply_settings
|
518
575
|
color
|
519
576
|
compile-concurrency
|
@@ -523,14 +580,18 @@ module Bolt
|
|
523
580
|
inventoryfile
|
524
581
|
log
|
525
582
|
modulepath
|
583
|
+
module-install
|
526
584
|
modules
|
527
585
|
name
|
528
586
|
plans
|
587
|
+
plugin-cache
|
588
|
+
plugin-hooks
|
529
589
|
plugin_hooks
|
530
590
|
plugins
|
531
591
|
puppetdb
|
532
592
|
puppetfile
|
533
593
|
save-rerun
|
594
|
+
spinner
|
534
595
|
tasks
|
535
596
|
trusted-external-command
|
536
597
|
].freeze
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'bolt/error'
|
4
4
|
require 'bolt/util'
|
5
|
+
require 'bolt/validator'
|
5
6
|
require 'bolt/config/transport/options'
|
6
7
|
|
7
8
|
module Bolt
|
@@ -90,6 +91,14 @@ module Bolt
|
|
90
91
|
self::OPTIONS
|
91
92
|
end
|
92
93
|
|
94
|
+
def self.schema
|
95
|
+
{
|
96
|
+
type: Hash,
|
97
|
+
properties: self::TRANSPORT_OPTIONS.slice(*self::OPTIONS),
|
98
|
+
_plugin: true
|
99
|
+
}
|
100
|
+
end
|
101
|
+
|
93
102
|
private def defaults
|
94
103
|
unless defined? self.class::DEFAULTS
|
95
104
|
raise NotImplementedError,
|
@@ -116,25 +125,7 @@ module Bolt
|
|
116
125
|
|
117
126
|
# Validation defaults to just asserting the option types
|
118
127
|
private def validate
|
119
|
-
|
120
|
-
end
|
121
|
-
|
122
|
-
# Validates that each option is the correct type. Types are loaded from the TRANSPORT_OPTIONS hash.
|
123
|
-
private def assert_type
|
124
|
-
@config.each_pair do |opt, val|
|
125
|
-
types = Array(TRANSPORT_OPTIONS.dig(opt, :type)).compact
|
126
|
-
|
127
|
-
next if val.nil? || types.empty? || types.include?(val.class)
|
128
|
-
|
129
|
-
# Ruby doesn't have a Boolean class, so add it to the types list if TrueClass or FalseClass
|
130
|
-
# are present.
|
131
|
-
if types.include?(TrueClass) || types.include?(FalseClass)
|
132
|
-
types = types - [TrueClass, FalseClass] + ['Boolean']
|
133
|
-
end
|
134
|
-
|
135
|
-
raise Bolt::ValidationError,
|
136
|
-
"#{opt} must be of type #{types.join(', ')}; received #{val.class} #{val.inspect} "
|
137
|
-
end
|
128
|
+
Bolt::Validator.new.validate(@config.compact, self.class.schema)
|
138
129
|
end
|
139
130
|
end
|
140
131
|
end
|