bolt 2.38.0 → 3.0.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 +17 -17
- 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/wait_until_available.rb +7 -3
- data/lib/bolt/analytics.rb +3 -2
- data/lib/bolt/applicator.rb +11 -1
- data/lib/bolt/bolt_option_parser.rb +3 -113
- data/lib/bolt/catalog.rb +10 -29
- data/lib/bolt/cli.rb +54 -155
- data/lib/bolt/config.rb +63 -269
- data/lib/bolt/config/options.rb +59 -97
- data/lib/bolt/config/transport/local.rb +1 -0
- data/lib/bolt/config/transport/options.rb +10 -2
- data/lib/bolt/config/transport/orch.rb +1 -0
- data/lib/bolt/config/transport/ssh.rb +0 -5
- data/lib/bolt/executor.rb +15 -5
- data/lib/bolt/inventory.rb +3 -2
- data/lib/bolt/inventory/group.rb +35 -12
- data/lib/bolt/inventory/inventory.rb +1 -1
- data/lib/bolt/logger.rb +115 -11
- data/lib/bolt/module.rb +10 -2
- data/lib/bolt/module_installer.rb +4 -2
- data/lib/bolt/module_installer/resolver.rb +65 -12
- 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 +9 -5
- data/lib/bolt/outputter/json.rb +16 -16
- 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 +7 -19
- data/lib/bolt/pal/yaml_plan/step.rb +3 -24
- data/lib/bolt/pal/yaml_plan/step/upload.rb +2 -2
- data/lib/bolt/pal/yaml_plan/transpiler.rb +6 -1
- data/lib/bolt/plugin.rb +3 -3
- data/lib/bolt/plugin/cache.rb +8 -8
- 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 +4 -3
- data/lib/bolt/project_manager/module_migrator.rb +6 -5
- 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 +3 -4
- data/lib/bolt/shell/powershell/snippets.rb +9 -149
- data/lib/bolt/task.rb +1 -1
- data/lib/bolt/transport/docker/connection.rb +2 -2
- data/lib/bolt/transport/local.rb +1 -9
- 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 +16 -15
- data/lib/bolt/version.rb +1 -1
- data/lib/bolt_server/config.rb +1 -1
- data/lib/bolt_server/schemas/partials/task.json +1 -1
- data/lib/bolt_server/transport_app.rb +3 -2
- 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 +31 -0
- data/modules/puppetdb_fact/plans/init.pp +10 -0
- metadata +26 -17
- data/modules/aggregate/plans/nodes.pp +0 -36
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 = {
|
@@ -351,7 +352,7 @@ module BoltServer
|
|
351
352
|
end
|
352
353
|
|
353
354
|
def allowed_helper(metadata, allowlist)
|
354
|
-
allowed = allowlist.nil? || allowlist.include?(metadata['name'])
|
355
|
+
allowed = allowlist.nil? || allowlist.include?(metadata['name'])
|
355
356
|
metadata.merge({ 'allowed' => allowed })
|
356
357
|
end
|
357
358
|
|
data/libexec/bolt_catalog
CHANGED
@@ -1,3 +1,24 @@
|
|
1
|
+
# @summary
|
2
|
+
# Run a task, command, or script on targets and aggregate the results as
|
3
|
+
# a count of targets for each value of a key.
|
4
|
+
#
|
5
|
+
# This plan accepts an action and a list of targets. The action can be the name
|
6
|
+
# of a task, a script, or a command to run. It will run the action on the
|
7
|
+
# targets and aggregate the key/value pairs in each Result into a hash, mapping
|
8
|
+
# the keys to a hash of each distinct value and how many targets returned that
|
9
|
+
# value for the key.
|
10
|
+
#
|
11
|
+
# @param command
|
12
|
+
# The command to run. Mutually exclusive with script and task.
|
13
|
+
# @param script
|
14
|
+
# The path to the script to run. Mutually exclusive with command and task.
|
15
|
+
# @param task
|
16
|
+
# The name of the task to run. Mutually exclusive with command and script.
|
17
|
+
# @param targets
|
18
|
+
# The list of targets to run the action on.
|
19
|
+
# @param params
|
20
|
+
# A hash of parameters and options to pass to the `run_*` function
|
21
|
+
# associated with the action (e.g. run_task).
|
1
22
|
plan aggregate::count(
|
2
23
|
Optional[String[0]] $task = undef,
|
3
24
|
Optional[String[0]] $command = undef,
|
@@ -1,3 +1,24 @@
|
|
1
|
+
# @summary
|
2
|
+
# Run a task, command, or script on targets and aggregate the results as
|
3
|
+
# the list of targets for each value of a key in the results.
|
4
|
+
#
|
5
|
+
# This plan accepts an action and a list of targets. The action can be the name
|
6
|
+
# of a task, a script, or a command to run. It will run the action on the
|
7
|
+
# targets and aggregate the key/value pairs in each Result into a hash, mapping
|
8
|
+
# the keys to a hash of each distinct value and a list of targets returning that
|
9
|
+
# value.
|
10
|
+
#
|
11
|
+
# @param command
|
12
|
+
# The command to run. Mutually exclusive with script and task.
|
13
|
+
# @param script
|
14
|
+
# The path to the script to run. Mutually exclusive with command and task.
|
15
|
+
# @param task
|
16
|
+
# The name of the task to run. Mutually exclusive with command and script.
|
17
|
+
# @param targets
|
18
|
+
# The list of targets to run the action on.
|
19
|
+
# @param params
|
20
|
+
# A hash of parameters and options to pass to the `run_*` function
|
21
|
+
# associated with the action (e.g. run_task).
|
1
22
|
plan aggregate::targets(
|
2
23
|
Optional[String[0]] $task = undef,
|
3
24
|
Optional[String[0]] $command = undef,
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# @summary
|
2
|
+
# Tests that the provided Puppet Connect input data is complete, meaning that all consuming inventory targets are connectable.
|
3
|
+
#
|
4
|
+
# This plan should only be used as part of the copy-pastable "test input data"
|
5
|
+
# workflow specified in the Puppet Connect docs.
|
6
|
+
#
|
7
|
+
# @param targets
|
8
|
+
# The set of targets to test. Usually this should be 'all', the default.
|
9
|
+
#
|
10
|
+
# @return ResultSet the result of invoking the 'is connectable?' query on all
|
11
|
+
# the targets. Note that this query currently consists of running the 'echo'
|
12
|
+
# command.
|
13
|
+
#
|
14
|
+
plan puppet_connect::test_input_data(TargetSpec $targets = 'all') {
|
15
|
+
$targs = get_targets($targets)
|
16
|
+
$targs.each |$target| {
|
17
|
+
if $target.transport != 'ssh' and $target.transport != 'winrm' {
|
18
|
+
fail_plan("Inventory contains target ${target} with unsupported transport, must be ssh or winrm")
|
19
|
+
}
|
20
|
+
if $target.transport == 'ssh' {
|
21
|
+
# Disable SSH autoloading to prevent false positive results
|
22
|
+
# (input data is wrong but target is still connectable due
|
23
|
+
# to autoloaded config)
|
24
|
+
set_config($target, ['ssh', 'load-config'], false)
|
25
|
+
}
|
26
|
+
}
|
27
|
+
# The SSH/WinRM transports will report an 'unknown host' error for targets where
|
28
|
+
# 'host' is unknown so run_command's implementation will take care of raising that
|
29
|
+
# error for us.
|
30
|
+
return run_command('echo Connected', $targs)
|
31
|
+
}
|
@@ -1,3 +1,13 @@
|
|
1
|
+
# @summary
|
2
|
+
# Collect facts for the specified targets from PuppetDB and store them
|
3
|
+
# on the Targets.
|
4
|
+
#
|
5
|
+
# This plan accepts a list of targets to collect facts for from the configured
|
6
|
+
# PuppetDB connection. After collecting facts, they are stored on each target's
|
7
|
+
# Target object. The updated facts can then be accessed using `$target.facts`.
|
8
|
+
#
|
9
|
+
# @param targets
|
10
|
+
# The targets to collect facts for.
|
1
11
|
plan puppetdb_fact(TargetSpec $targets) {
|
2
12
|
$targs = get_targets($targets)
|
3
13
|
$certnames = $targs.map |$target| { $target.host }
|
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:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '1.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: ffi
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "<"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 1.14.0
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "<"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 1.14.0
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: hiera-eyaml
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -170,14 +184,14 @@ dependencies:
|
|
170
184
|
requirements:
|
171
185
|
- - "~>"
|
172
186
|
- !ruby/object:Gem::Version
|
173
|
-
version: '0.
|
187
|
+
version: '0.5'
|
174
188
|
type: :runtime
|
175
189
|
prerelease: false
|
176
190
|
version_requirements: !ruby/object:Gem::Requirement
|
177
191
|
requirements:
|
178
192
|
- - "~>"
|
179
193
|
- !ruby/object:Gem::Version
|
180
|
-
version: '0.
|
194
|
+
version: '0.5'
|
181
195
|
- !ruby/object:Gem::Dependency
|
182
196
|
name: puppet
|
183
197
|
requirement: !ruby/object:Gem::Requirement
|
@@ -198,14 +212,14 @@ dependencies:
|
|
198
212
|
requirements:
|
199
213
|
- - "~>"
|
200
214
|
- !ruby/object:Gem::Version
|
201
|
-
version: '0.
|
215
|
+
version: '0.5'
|
202
216
|
type: :runtime
|
203
217
|
prerelease: false
|
204
218
|
version_requirements: !ruby/object:Gem::Requirement
|
205
219
|
requirements:
|
206
220
|
- - "~>"
|
207
221
|
- !ruby/object:Gem::Version
|
208
|
-
version: '0.
|
222
|
+
version: '0.5'
|
209
223
|
- !ruby/object:Gem::Dependency
|
210
224
|
name: puppet-resource_api
|
211
225
|
requirement: !ruby/object:Gem::Requirement
|
@@ -311,9 +325,6 @@ dependencies:
|
|
311
325
|
- - ">="
|
312
326
|
- !ruby/object:Gem::Version
|
313
327
|
version: '1.14'
|
314
|
-
- - "<"
|
315
|
-
- !ruby/object:Gem::Version
|
316
|
-
version: 2.2.0
|
317
328
|
type: :development
|
318
329
|
prerelease: false
|
319
330
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -321,9 +332,6 @@ dependencies:
|
|
321
332
|
- - ">="
|
322
333
|
- !ruby/object:Gem::Version
|
323
334
|
version: '1.14'
|
324
|
-
- - "<"
|
325
|
-
- !ruby/object:Gem::Version
|
326
|
-
version: 2.2.0
|
327
335
|
- !ruby/object:Gem::Dependency
|
328
336
|
name: octokit
|
329
337
|
requirement: !ruby/object:Gem::Requirement
|
@@ -342,16 +350,16 @@ dependencies:
|
|
342
350
|
name: puppetlabs_spec_helper
|
343
351
|
requirement: !ruby/object:Gem::Requirement
|
344
352
|
requirements:
|
345
|
-
- - "
|
353
|
+
- - "<="
|
346
354
|
- !ruby/object:Gem::Version
|
347
|
-
version:
|
355
|
+
version: 2.15.0
|
348
356
|
type: :development
|
349
357
|
prerelease: false
|
350
358
|
version_requirements: !ruby/object:Gem::Requirement
|
351
359
|
requirements:
|
352
|
-
- - "
|
360
|
+
- - "<="
|
353
361
|
- !ruby/object:Gem::Version
|
354
|
-
version:
|
362
|
+
version: 2.15.0
|
355
363
|
- !ruby/object:Gem::Dependency
|
356
364
|
name: rake
|
357
365
|
requirement: !ruby/object:Gem::Requirement
|
@@ -515,6 +523,7 @@ files:
|
|
515
523
|
- lib/bolt/plugin/env_var.rb
|
516
524
|
- lib/bolt/plugin/module.rb
|
517
525
|
- lib/bolt/plugin/prompt.rb
|
526
|
+
- lib/bolt/plugin/puppet_connect_data.rb
|
518
527
|
- lib/bolt/plugin/puppetdb.rb
|
519
528
|
- lib/bolt/plugin/task.rb
|
520
529
|
- lib/bolt/project.rb
|
@@ -600,12 +609,12 @@ files:
|
|
600
609
|
- modules/aggregate/lib/puppet/functions/aggregate/nodes.rb
|
601
610
|
- modules/aggregate/lib/puppet/functions/aggregate/targets.rb
|
602
611
|
- modules/aggregate/plans/count.pp
|
603
|
-
- modules/aggregate/plans/nodes.pp
|
604
612
|
- modules/aggregate/plans/targets.pp
|
605
613
|
- modules/canary/lib/puppet/functions/canary/merge.rb
|
606
614
|
- modules/canary/lib/puppet/functions/canary/random_split.rb
|
607
615
|
- modules/canary/lib/puppet/functions/canary/skip.rb
|
608
616
|
- modules/canary/plans/init.pp
|
617
|
+
- modules/puppet_connect/plans/test_input_data.pp
|
609
618
|
- modules/puppetdb_fact/plans/init.pp
|
610
619
|
homepage: https://github.com/puppetlabs/bolt
|
611
620
|
licenses:
|
@@ -1,36 +0,0 @@
|
|
1
|
-
plan aggregate::nodes(
|
2
|
-
Optional[String[0]] $task = undef,
|
3
|
-
Optional[String[0]] $command = undef,
|
4
|
-
Optional[String[0]] $script = undef,
|
5
|
-
TargetSpec $nodes,
|
6
|
-
Hash[String, Data] $params = {}
|
7
|
-
) {
|
8
|
-
|
9
|
-
# Validation
|
10
|
-
$type_count = [$task, $command, $script].reduce(0) |$acc, $v| {
|
11
|
-
if ($v) {
|
12
|
-
$acc + 1
|
13
|
-
} else {
|
14
|
-
$acc
|
15
|
-
}
|
16
|
-
}
|
17
|
-
|
18
|
-
if ($type_count == 0) {
|
19
|
-
fail_plan("Must specify a command, script, or task to run", 'aggregate/invalid-params')
|
20
|
-
}
|
21
|
-
|
22
|
-
if ($type_count > 1) {
|
23
|
-
fail_plan("Must specify only one command, script, or task to run", 'aggregate/invalid-params')
|
24
|
-
}
|
25
|
-
|
26
|
-
$res = if ($task) {
|
27
|
-
run_task($task, $nodes, $params)
|
28
|
-
} elsif ($command) {
|
29
|
-
run_command($command, $nodes, $params)
|
30
|
-
} elsif ($script) {
|
31
|
-
run_script($script, $nodes, $params)
|
32
|
-
}
|
33
|
-
|
34
|
-
return aggregate::nodes($res)
|
35
|
-
}
|
36
|
-
|