bolt 2.40.2 → 3.1.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 +19 -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 +62 -239
- data/lib/bolt/config/options.rb +58 -97
- data/lib/bolt/config/transport/local.rb +1 -0
- data/lib/bolt/config/transport/options.rb +8 -1
- data/lib/bolt/config/transport/orch.rb +1 -0
- data/lib/bolt/executor.rb +15 -5
- data/lib/bolt/inventory.rb +3 -2
- data/lib/bolt/inventory/group.rb +35 -4
- 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 +94 -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 +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 +4 -3
- data/lib/bolt/project_manager/module_migrator.rb +6 -5
- data/lib/bolt/rerun.rb +1 -1
- data/lib/bolt/result.rb +6 -1
- data/lib/bolt/shell/bash.rb +9 -4
- data/lib/bolt/shell/bash/tmpdir.rb +4 -1
- data/lib/bolt/shell/powershell.rb +9 -5
- data/lib/bolt/shell/powershell/snippets.rb +37 -150
- data/lib/bolt/task.rb +1 -1
- 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/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 +48 -31
- data/lib/bolt_spec/bolt_context.rb +9 -4
- data/lib/bolt_spec/plans.rb +1 -109
- 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 +28 -19
- data/modules/aggregate/plans/nodes.pp +0 -36
@@ -0,0 +1,67 @@
|
|
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
|
+
case $target.transport {
|
18
|
+
'ssh': {
|
19
|
+
$private_key_config = dig($target.config, 'ssh', 'private-key')
|
20
|
+
if $private_key_config =~ String {
|
21
|
+
$msg = @("END")
|
22
|
+
The SSH private key of the ${$target} target points to a filepath on disk,
|
23
|
+
which is not allowed in Puppet Connect. Instead, the private key contents must
|
24
|
+
be specified and this should be done via the PuppetConnectData plugin. Below is
|
25
|
+
an example of a Puppet Connect-compatible specification of the private-key. First,
|
26
|
+
we start with the inventory file:
|
27
|
+
...
|
28
|
+
private-key:
|
29
|
+
_plugin: puppet_connect_data
|
30
|
+
key: ssh_private_key
|
31
|
+
...
|
32
|
+
|
33
|
+
Next is the corresponding entry in the input data file:
|
34
|
+
...
|
35
|
+
ssh_private_key:
|
36
|
+
key-data:
|
37
|
+
<private_key_contents>
|
38
|
+
...
|
39
|
+
| END
|
40
|
+
|
41
|
+
out::message($msg)
|
42
|
+
fail_plan("The SSH private key of the ${$target} target points to a filepath on disk")
|
43
|
+
}
|
44
|
+
|
45
|
+
# Disable SSH autoloading to prevent false positive results
|
46
|
+
# (input data is wrong but target is still connectable due
|
47
|
+
# to autoloaded config)
|
48
|
+
set_config($target, ['ssh', 'load-config'], false)
|
49
|
+
# Maintain configuration parity with Puppet Connect to improve
|
50
|
+
# the reliability of our test
|
51
|
+
set_config($target, ['ssh', 'host-key-check'], false)
|
52
|
+
}
|
53
|
+
'winrm': {
|
54
|
+
# Maintain configuration parity with Puppet Connect
|
55
|
+
set_config($target, ['winrm', 'ssl'], false)
|
56
|
+
set_config($target, ['winrm', 'ssl-verify'], false)
|
57
|
+
}
|
58
|
+
default: {
|
59
|
+
fail_plan("Inventory contains target ${target} with unsupported transport, must be ssh or winrm")
|
60
|
+
}
|
61
|
+
}
|
62
|
+
}
|
63
|
+
# The SSH/WinRM transports will report an 'unknown host' error for targets where
|
64
|
+
# 'host' is unknown so run_command's implementation will take care of raising that
|
65
|
+
# error for us.
|
66
|
+
return run_command('echo Connected', $targs)
|
67
|
+
}
|
@@ -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.1.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-03-01 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
|
@@ -196,16 +210,16 @@ dependencies:
|
|
196
210
|
name: puppetfile-resolver
|
197
211
|
requirement: !ruby/object:Gem::Requirement
|
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
|
-
|