openbolt 5.4.0 → 5.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Puppetfile +8 -9
- data/bolt-modules/boltlib/lib/puppet/datatypes/target.rb +2 -2
- data/bolt-modules/boltlib/lib/puppet/functions/facts.rb +1 -1
- data/lib/bolt/application.rb +2 -4
- data/lib/bolt/bolt_option_parser.rb +63 -1
- data/lib/bolt/cli.rb +1 -1
- data/lib/bolt/config/options.rb +16 -2
- data/lib/bolt/config/transport/choria.rb +74 -0
- data/lib/bolt/config/transport/options.rb +108 -0
- data/lib/bolt/executor.rb +2 -0
- data/lib/bolt/outputter/human.rb +1 -1
- data/lib/bolt/outputter/json.rb +2 -2
- data/lib/bolt/outputter/rainbow.rb +5 -1
- data/lib/bolt/pal/yaml_plan/transpiler.rb +1 -1
- data/lib/bolt/plugin/puppetdb.rb +1 -1
- data/lib/bolt/plugin.rb +1 -4
- data/lib/bolt/puppetdb/config.rb +8 -0
- data/lib/bolt/puppetdb/instance.rb +1 -0
- data/lib/bolt/result_set.rb +1 -1
- data/lib/bolt/transport/choria/agent_discovery.rb +137 -0
- data/lib/bolt/transport/choria/bolt_tasks.rb +248 -0
- data/lib/bolt/transport/choria/client.rb +281 -0
- data/lib/bolt/transport/choria/command_builders.rb +199 -0
- data/lib/bolt/transport/choria/helpers.rb +197 -0
- data/lib/bolt/transport/choria/shell.rb +560 -0
- data/lib/bolt/transport/choria.rb +218 -0
- data/lib/bolt/transport/winrm/connection.rb +13 -3
- data/lib/bolt/version.rb +1 -1
- data/lib/mcollective/agent/shell.ddl +154 -0
- metadata +39 -12
- data/lib/bolt/plugin/puppet_connect_data.rb +0 -85
- data/modules/puppet_connect/plans/test_input_data.pp +0 -94
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c5d6647a2e9293dcfa5e980643d19bb67764ace9cf6832bb0928e82e15ee8f42
|
|
4
|
+
data.tar.gz: 4731f17b8df92c12cfc582b9952c0c0d19582854aeb9e8cf05193962cff5f542
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d99ea67f58ae861d512f56573fa76c6b14d05f833843c7513697b5d7311c6ef712132a28ebf5919b0a45b51f51d9b4a1cad6261aefb7e85139b00eb2a7be24d1
|
|
7
|
+
data.tar.gz: 8ff49e9017d8a9a4870e2854a221420aaf1f1750693cd6940ad9f32041093d08a31a756d6584ef85fc26a3506208fceb829f40f6821b0424bcafba1088e68544
|
data/Puppetfile
CHANGED
|
@@ -6,12 +6,12 @@ moduledir File.join(File.dirname(__FILE__), 'modules')
|
|
|
6
6
|
|
|
7
7
|
# Core modules used by 'apply'
|
|
8
8
|
mod 'puppetlabs-service', '3.1.0'
|
|
9
|
-
mod 'puppet-openvox_bootstrap', '1.
|
|
9
|
+
mod 'puppet-openvox_bootstrap', '1.4.0'
|
|
10
10
|
mod 'puppetlabs-facts', '1.7.0'
|
|
11
11
|
|
|
12
12
|
# Other core Puppet modules
|
|
13
|
-
mod 'puppetlabs-inifile', '6.
|
|
14
|
-
mod 'puppetlabs-apt', '11.
|
|
13
|
+
mod 'puppetlabs-inifile', '6.4.0'
|
|
14
|
+
mod 'puppetlabs-apt', '11.3.1'
|
|
15
15
|
mod 'puppetlabs-stdlib', '9.7.0'
|
|
16
16
|
mod 'puppetlabs-powershell', '6.1.0'
|
|
17
17
|
mod 'puppetlabs-pwshlib', '2.0.1'
|
|
@@ -42,17 +42,16 @@ mod 'puppetlabs-bash_task_helper', '2.2.0'
|
|
|
42
42
|
|
|
43
43
|
# Plugin modules
|
|
44
44
|
mod 'puppetlabs-aws_inventory', '0.7.0'
|
|
45
|
-
mod 'puppetlabs-azure_inventory', '0.5.
|
|
46
|
-
mod 'puppetlabs-gcloud_inventory', '0.3.
|
|
47
|
-
mod 'puppetlabs-http_request', '0.3.
|
|
45
|
+
mod 'puppetlabs-azure_inventory', '0.5.1'
|
|
46
|
+
mod 'puppetlabs-gcloud_inventory', '0.3.1'
|
|
47
|
+
mod 'puppetlabs-http_request', '0.3.2'
|
|
48
48
|
mod 'puppetlabs-pkcs7', '0.1.2'
|
|
49
49
|
mod 'puppetlabs-secure_env_vars', '0.2.0'
|
|
50
|
-
mod 'puppetlabs-terraform', '0.7.
|
|
51
|
-
mod 'puppetlabs-vault', '0.4.
|
|
50
|
+
mod 'puppetlabs-terraform', '0.7.2'
|
|
51
|
+
mod 'puppetlabs-vault', '0.4.1'
|
|
52
52
|
mod 'puppetlabs-yaml', '0.2.0'
|
|
53
53
|
|
|
54
54
|
# If we don't list these modules explicitly, r10k will purge them
|
|
55
55
|
mod 'canary', local: true
|
|
56
56
|
mod 'aggregate', local: true
|
|
57
57
|
mod 'puppetdb_fact', local: true
|
|
58
|
-
mod 'puppet_connect', local: true
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
# The target's facts. This function does not look up facts for a target and
|
|
12
12
|
# only returns the facts specified in an `inventory.yaml` file or set on a
|
|
13
13
|
# target during a plan run. To retrieve facts for a target and set them in
|
|
14
|
-
# inventory, run the [facts](writing_plans.md#collect-facts-from-targets)
|
|
14
|
+
# inventory, run the [facts](writing_plans.md#collect-facts-from-the-targets)
|
|
15
15
|
# plan or [puppetdb_fact](writing_plans.md#collect-facts-from-puppetdb)
|
|
16
16
|
# plan.
|
|
17
17
|
# @param features
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
# The target's human-readable name, or its URI if a name was not given.
|
|
21
21
|
# @param plugin_hooks
|
|
22
22
|
# The target's `plugin_hooks` [configuration
|
|
23
|
-
# options](bolt_inventory_reference.md#
|
|
23
|
+
# options](bolt_inventory_reference.md#plugin_hooks-1).
|
|
24
24
|
# @param resources
|
|
25
25
|
# The target's resources. This function does not look up resources for a
|
|
26
26
|
# target and only returns resources set on a target during a plan run.
|
|
@@ -7,7 +7,7 @@ require 'bolt/error'
|
|
|
7
7
|
# Using the `facts` function does not automatically collect facts for a target,
|
|
8
8
|
# and will only return facts that are currently set in the inventory. To collect
|
|
9
9
|
# facts from a target and set them in the inventory, run the
|
|
10
|
-
# [facts](writing_plans.md#collect-facts-from-targets) plan or
|
|
10
|
+
# [facts](writing_plans.md#collect-facts-from-the-targets) plan or
|
|
11
11
|
# [puppetdb_fact](writing_plans.md#collect-facts-from-puppetdb) plan.
|
|
12
12
|
Puppet::Functions.create_function(:facts) do
|
|
13
13
|
# @param target A target.
|
data/lib/bolt/application.rb
CHANGED
|
@@ -148,10 +148,8 @@ module Bolt
|
|
|
148
148
|
|
|
149
149
|
# Show available guides.
|
|
150
150
|
#
|
|
151
|
-
# @
|
|
152
|
-
#
|
|
153
|
-
# @return [Boolean]
|
|
154
|
-
#
|
|
151
|
+
# @return [Hash] A map of topics of guides
|
|
152
|
+
# Currently, the map is structured as `:topics => [Array] of guide names`
|
|
155
153
|
def list_guides
|
|
156
154
|
{ topics: load_guides.keys }
|
|
157
155
|
end
|
|
@@ -13,6 +13,11 @@ module Bolt
|
|
|
13
13
|
run_context: %w[concurrency inventoryfile save-rerun cleanup puppetdb],
|
|
14
14
|
global_config_setters: PROJECT_PATHS + %w[modulepath],
|
|
15
15
|
transports: %w[transport connect-timeout tty native-ssh ssh-command copy-command],
|
|
16
|
+
choria: %w[choria-config-file choria-mcollective-certname
|
|
17
|
+
choria-ssl-ca choria-ssl-cert choria-ssl-key
|
|
18
|
+
choria-collective choria-puppet-environment choria-rpc-timeout
|
|
19
|
+
choria-task-timeout choria-command-timeout choria-brokers
|
|
20
|
+
choria-broker-timeout],
|
|
16
21
|
display: %w[format color verbose trace stream],
|
|
17
22
|
global: %w[help version log-level clear-cache] }.freeze
|
|
18
23
|
|
|
@@ -168,7 +173,7 @@ module Bolt
|
|
|
168
173
|
when 'task'
|
|
169
174
|
case action
|
|
170
175
|
when 'run'
|
|
171
|
-
{ flags: ACTION_OPTS + %w[params tmpdir noop],
|
|
176
|
+
{ flags: ACTION_OPTS + %w[params tmpdir noop choria-task-agent],
|
|
172
177
|
banner: TASK_RUN_HELP }
|
|
173
178
|
when 'show'
|
|
174
179
|
{ flags: OPTIONS[:global] + OPTIONS[:global_config_setters] + %w[filter format],
|
|
@@ -1095,6 +1100,63 @@ module Bolt
|
|
|
1095
1100
|
define('--tmpdir DIR', 'The directory to upload and execute temporary files on the target.') do |tmpdir|
|
|
1096
1101
|
@options[:tmpdir] = tmpdir
|
|
1097
1102
|
end
|
|
1103
|
+
define('--choria-task-agent AGENT', %w[bolt_tasks shell],
|
|
1104
|
+
"Which Choria agent to use for task execution (bolt_tasks, shell).",
|
|
1105
|
+
"Defaults to 'bolt_tasks'. Set to 'shell' for tasks not on the Puppet Server.") do |agent|
|
|
1106
|
+
@options[:'task-agent'] = agent
|
|
1107
|
+
end
|
|
1108
|
+
define('--choria-config-file PATH',
|
|
1109
|
+
'Path to a Choria/MCollective client configuration file.') do |path|
|
|
1110
|
+
@options[:'config-file'] = path
|
|
1111
|
+
end
|
|
1112
|
+
define('--choria-mcollective-certname NAME',
|
|
1113
|
+
'Override the MCollective certname for Choria client identity.',
|
|
1114
|
+
'The choria-mcorpc-support library identifies non-root clients',
|
|
1115
|
+
"as '<username>.mcollective', which fails when authenticating",
|
|
1116
|
+
"with a certificate that has a different CN (e.g. the host's",
|
|
1117
|
+
'Puppet cert). Set this to the CN of the certificate being used.') do |name|
|
|
1118
|
+
@options[:'mcollective-certname'] = name
|
|
1119
|
+
end
|
|
1120
|
+
define('--choria-ssl-ca PATH',
|
|
1121
|
+
'CA certificate path for Choria TLS authentication.') do |path|
|
|
1122
|
+
@options[:'ssl-ca'] = path
|
|
1123
|
+
end
|
|
1124
|
+
define('--choria-ssl-cert PATH',
|
|
1125
|
+
'Client certificate path for Choria TLS authentication.') do |path|
|
|
1126
|
+
@options[:'ssl-cert'] = path
|
|
1127
|
+
end
|
|
1128
|
+
define('--choria-ssl-key PATH',
|
|
1129
|
+
'Client private key path for Choria TLS authentication.') do |path|
|
|
1130
|
+
@options[:'ssl-key'] = path
|
|
1131
|
+
end
|
|
1132
|
+
define('--choria-collective NAME',
|
|
1133
|
+
'Choria collective to route messages through.') do |name|
|
|
1134
|
+
@options[:collective] = name
|
|
1135
|
+
end
|
|
1136
|
+
define('--choria-puppet-environment ENV',
|
|
1137
|
+
"Puppet environment for bolt_tasks file downloads (default: 'production').") do |env|
|
|
1138
|
+
@options[:'puppet-environment'] = env
|
|
1139
|
+
end
|
|
1140
|
+
define('--choria-rpc-timeout SECONDS', Integer,
|
|
1141
|
+
'Seconds to wait for replies to individual Choria RPC calls (default: 30).') do |timeout|
|
|
1142
|
+
@options[:'rpc-timeout'] = timeout
|
|
1143
|
+
end
|
|
1144
|
+
define('--choria-task-timeout SECONDS', Integer,
|
|
1145
|
+
'Seconds to wait for task execution to complete (default: 300).') do |timeout|
|
|
1146
|
+
@options[:'task-timeout'] = timeout
|
|
1147
|
+
end
|
|
1148
|
+
define('--choria-command-timeout SECONDS', Integer,
|
|
1149
|
+
'Seconds to wait for commands and scripts to complete (default: 60).') do |timeout|
|
|
1150
|
+
@options[:'command-timeout'] = timeout
|
|
1151
|
+
end
|
|
1152
|
+
define('--choria-brokers BROKERS',
|
|
1153
|
+
'Choria broker addresses in host or host:port format (comma-separated). Port defaults to 4222 if omitted.') do |brokers|
|
|
1154
|
+
@options[:brokers] = brokers.split(',')
|
|
1155
|
+
end
|
|
1156
|
+
define('--choria-broker-timeout SECONDS', Integer,
|
|
1157
|
+
'Seconds to wait for the TCP connection to a Choria broker (default: 30).') do |timeout|
|
|
1158
|
+
@options[:'broker-timeout'] = timeout
|
|
1159
|
+
end
|
|
1098
1160
|
|
|
1099
1161
|
separator "\n#{self.class.colorize(:cyan, 'Module options')}"
|
|
1100
1162
|
define('--[no-]resolve',
|
data/lib/bolt/cli.rb
CHANGED
|
@@ -750,7 +750,7 @@ module Bolt
|
|
|
750
750
|
# built-in modules are installed.
|
|
751
751
|
#
|
|
752
752
|
private def incomplete_install?
|
|
753
|
-
builtin_module_list = %w[aggregate canary puppetdb_fact secure_env_vars
|
|
753
|
+
builtin_module_list = %w[aggregate canary puppetdb_fact secure_env_vars]
|
|
754
754
|
(Dir.children(Bolt::Config::Modulepath::MODULES_PATH) - builtin_module_list).empty?
|
|
755
755
|
end
|
|
756
756
|
|
data/lib/bolt/config/options.rb
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require_relative '../../bolt/config/transport/choria'
|
|
3
4
|
require_relative '../../bolt/config/transport/docker'
|
|
4
5
|
require_relative '../../bolt/config/transport/jail'
|
|
5
6
|
require_relative '../../bolt/config/transport/local'
|
|
@@ -15,6 +16,7 @@ module Bolt
|
|
|
15
16
|
# Transport config classes. Used to load default transport config which
|
|
16
17
|
# gets passed along to the inventory.
|
|
17
18
|
TRANSPORT_CONFIG = {
|
|
19
|
+
'choria' => Bolt::Config::Transport::Choria,
|
|
18
20
|
'docker' => Bolt::Config::Transport::Docker,
|
|
19
21
|
'jail' => Bolt::Config::Transport::Jail,
|
|
20
22
|
'local' => Bolt::Config::Transport::Local,
|
|
@@ -76,6 +78,12 @@ module Bolt
|
|
|
76
78
|
_example: 120,
|
|
77
79
|
_plugin: true
|
|
78
80
|
},
|
|
81
|
+
"headers" => {
|
|
82
|
+
description: "A map of HTTP headers to add to PuppetDB requests.",
|
|
83
|
+
type: Hash,
|
|
84
|
+
_example: { "Authorization" => "Bearer <token>" },
|
|
85
|
+
_plugin: true
|
|
86
|
+
},
|
|
79
87
|
"key" => {
|
|
80
88
|
description: "The private key for the certificate.",
|
|
81
89
|
type: String,
|
|
@@ -428,10 +436,10 @@ module Bolt
|
|
|
428
436
|
_example: ["myproject", "myproject::foo", "myproject::bar", "myproject::deploy::*"]
|
|
429
437
|
},
|
|
430
438
|
"plugin-hooks" => {
|
|
431
|
-
description: "A map of [plugin hooks](writing_plugins.md#hooks) and which plugins a hook should use. " \
|
|
439
|
+
description: "A map of [plugin hooks](writing_plugins.md#plugin-hooks) and which plugins a hook should use. " \
|
|
432
440
|
"The only configurable plugin hook is `puppet_library`, which can use two possible plugins: " \
|
|
433
441
|
"[`openvox_bootstrap`](https://github.com/voxpupuli/puppet-openvox_bootstrap#openvox_boostrapinstall) " \
|
|
434
|
-
"and [`task`](
|
|
442
|
+
"and [`task`](supported_plugins.md#task).",
|
|
435
443
|
type: Hash,
|
|
436
444
|
_plugin: true,
|
|
437
445
|
_example: { "puppet_library" => { "plugin" => "openvox_bootstrap", "version" => "1.2.0",
|
|
@@ -545,6 +553,12 @@ module Bolt
|
|
|
545
553
|
_example: "winrm",
|
|
546
554
|
_default: "ssh"
|
|
547
555
|
},
|
|
556
|
+
"choria" => {
|
|
557
|
+
description: "A map of configuration options for the choria transport.",
|
|
558
|
+
type: Hash,
|
|
559
|
+
_plugin: true,
|
|
560
|
+
_example: { "config-file" => "/etc/choria/client.conf" }
|
|
561
|
+
},
|
|
548
562
|
"docker" => {
|
|
549
563
|
description: "A map of configuration options for the docker transport.",
|
|
550
564
|
type: Hash,
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative '../../../bolt/error'
|
|
4
|
+
require_relative '../../../bolt/config/transport/base'
|
|
5
|
+
|
|
6
|
+
module Bolt
|
|
7
|
+
class Config
|
|
8
|
+
module Transport
|
|
9
|
+
class Choria < Base
|
|
10
|
+
OPTIONS = %w[
|
|
11
|
+
cleanup
|
|
12
|
+
collective
|
|
13
|
+
command-timeout
|
|
14
|
+
config-file
|
|
15
|
+
host
|
|
16
|
+
interpreters
|
|
17
|
+
mcollective-certname
|
|
18
|
+
broker-timeout
|
|
19
|
+
brokers
|
|
20
|
+
puppet-environment
|
|
21
|
+
rpc-timeout
|
|
22
|
+
ssl-ca
|
|
23
|
+
ssl-cert
|
|
24
|
+
ssl-key
|
|
25
|
+
task-agent
|
|
26
|
+
task-timeout
|
|
27
|
+
tmpdir
|
|
28
|
+
].sort.freeze
|
|
29
|
+
|
|
30
|
+
DEFAULTS = {
|
|
31
|
+
'cleanup' => true,
|
|
32
|
+
'command-timeout' => 60,
|
|
33
|
+
'broker-timeout' => 30,
|
|
34
|
+
'puppet-environment' => 'production',
|
|
35
|
+
'rpc-timeout' => 30,
|
|
36
|
+
'task-timeout' => 300,
|
|
37
|
+
'tmpdir' => '/tmp'
|
|
38
|
+
}.freeze
|
|
39
|
+
|
|
40
|
+
VALID_AGENTS = %w[bolt_tasks shell].freeze
|
|
41
|
+
|
|
42
|
+
private def validate
|
|
43
|
+
super
|
|
44
|
+
|
|
45
|
+
if @config['task-agent'] && !VALID_AGENTS.include?(@config['task-agent'])
|
|
46
|
+
raise Bolt::ValidationError,
|
|
47
|
+
"task-agent must be one of #{VALID_AGENTS.join(', ')}, got '#{@config['task-agent']}'"
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
if @config['tmpdir'] && !absolute_path?(@config['tmpdir'])
|
|
51
|
+
raise Bolt::ValidationError,
|
|
52
|
+
"Choria tmpdir must be an absolute path, got '#{@config['tmpdir']}'"
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
ssl_keys = %w[ssl-ca ssl-cert ssl-key]
|
|
56
|
+
provided_ssl = ssl_keys.select { |k| @config[k] }
|
|
57
|
+
if provided_ssl.any? && provided_ssl.length < ssl_keys.length
|
|
58
|
+
missing = ssl_keys - provided_ssl
|
|
59
|
+
raise Bolt::ValidationError,
|
|
60
|
+
"When overriding Choria SSL settings, all three options must be provided " \
|
|
61
|
+
"(ssl-ca, ssl-cert, ssl-key). Missing: #{missing.join(', ')}"
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
@config['interpreters'] = normalize_interpreters(@config['interpreters']) if @config['interpreters']
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# Accept both POSIX absolute paths (/tmp) and Windows absolute paths (C:\temp).
|
|
68
|
+
def absolute_path?(path)
|
|
69
|
+
path.start_with?('/') || path.match?(Bolt::Transport::Choria::WINDOWS_PATH_REGEX)
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
@@ -51,6 +51,56 @@ module Bolt
|
|
|
51
51
|
_default: true,
|
|
52
52
|
_example: false
|
|
53
53
|
},
|
|
54
|
+
"task-agent" => {
|
|
55
|
+
type: String,
|
|
56
|
+
description: "Which Choria agent to use for task execution. Defaults to 'bolt_tasks' " \
|
|
57
|
+
"(downloads task files from a Puppet Server). Set to 'shell' for tasks " \
|
|
58
|
+
"not available on the Puppet Server.",
|
|
59
|
+
_plugin: true,
|
|
60
|
+
_example: "shell"
|
|
61
|
+
},
|
|
62
|
+
"collective" => {
|
|
63
|
+
type: String,
|
|
64
|
+
description: "The Choria collective to target. Overrides the main_collective from the Choria " \
|
|
65
|
+
"client configuration file.",
|
|
66
|
+
_plugin: true,
|
|
67
|
+
_example: "production"
|
|
68
|
+
},
|
|
69
|
+
"command-timeout" => {
|
|
70
|
+
type: Integer,
|
|
71
|
+
description: "How long to wait in seconds for commands and scripts to complete when using the " \
|
|
72
|
+
"Choria transport.",
|
|
73
|
+
minimum: 1,
|
|
74
|
+
_plugin: true,
|
|
75
|
+
_default: 60,
|
|
76
|
+
_example: 120
|
|
77
|
+
},
|
|
78
|
+
"config-file" => {
|
|
79
|
+
type: String,
|
|
80
|
+
description: "The path to the Choria or MCollective client configuration file.",
|
|
81
|
+
_plugin: true,
|
|
82
|
+
_example: "/etc/choria/client.conf"
|
|
83
|
+
},
|
|
84
|
+
"broker-timeout" => {
|
|
85
|
+
type: Integer,
|
|
86
|
+
description: "How long to wait in seconds for the initial TCP connection to a Choria broker. " \
|
|
87
|
+
"If the connection cannot be made within this time, the operation fails.",
|
|
88
|
+
minimum: 1,
|
|
89
|
+
_plugin: true,
|
|
90
|
+
_default: 30,
|
|
91
|
+
_example: 60
|
|
92
|
+
},
|
|
93
|
+
"rpc-timeout" => {
|
|
94
|
+
type: Integer,
|
|
95
|
+
description: "How long to wait in seconds for nodes to respond to an RPC request. " \
|
|
96
|
+
"Used for lightweight operations like agent discovery, shell.start, and " \
|
|
97
|
+
"shell.list polling. Distinct from command-timeout and task-timeout which " \
|
|
98
|
+
"govern the overall duration of commands and tasks.",
|
|
99
|
+
minimum: 1,
|
|
100
|
+
_plugin: true,
|
|
101
|
+
_default: 30,
|
|
102
|
+
_example: 60
|
|
103
|
+
},
|
|
54
104
|
"connect-timeout" => {
|
|
55
105
|
type: Integer,
|
|
56
106
|
description: "How long to wait in seconds when establishing connections. Set this value higher if you " \
|
|
@@ -225,6 +275,27 @@ module Bolt
|
|
|
225
275
|
_plugin: true,
|
|
226
276
|
_example: %w[defaults hmac-md5]
|
|
227
277
|
},
|
|
278
|
+
"mcollective-certname" => {
|
|
279
|
+
type: String,
|
|
280
|
+
description: "Override the MCollective certname used for Choria client identity. " \
|
|
281
|
+
"The choria-mcorpc-support library identifies non-root clients as " \
|
|
282
|
+
"'<username>.mcollective'. Set this when authenticating with a certificate " \
|
|
283
|
+
"whose CN differs from that default (e.g. the host's Puppet cert).",
|
|
284
|
+
_plugin: true,
|
|
285
|
+
_example: "primary.example.com"
|
|
286
|
+
},
|
|
287
|
+
"brokers" => {
|
|
288
|
+
type: [String, Array],
|
|
289
|
+
description: "One or more Choria broker addresses in host or host:port format. " \
|
|
290
|
+
"Port defaults to 4222 if omitted. Do not use the nats:// prefix. " \
|
|
291
|
+
"Overrides the middleware hosts from the Choria client configuration file. " \
|
|
292
|
+
"Can be a single string or an array.",
|
|
293
|
+
items: {
|
|
294
|
+
type: String
|
|
295
|
+
},
|
|
296
|
+
_plugin: true,
|
|
297
|
+
_example: ["broker1:4222", "broker2:4222"]
|
|
298
|
+
},
|
|
228
299
|
"native-ssh" => {
|
|
229
300
|
type: [TrueClass, FalseClass],
|
|
230
301
|
description: "This enables the native SSH transport, which shells out to SSH instead of using the " \
|
|
@@ -267,6 +338,14 @@ module Bolt
|
|
|
267
338
|
_plugin: true,
|
|
268
339
|
_example: "jump.example.com"
|
|
269
340
|
},
|
|
341
|
+
"puppet-environment" => {
|
|
342
|
+
type: String,
|
|
343
|
+
description: "The Puppet environment to use when constructing task file URIs for the Choria " \
|
|
344
|
+
"bolt_tasks agent.",
|
|
345
|
+
_plugin: true,
|
|
346
|
+
_default: "production",
|
|
347
|
+
_example: "staging"
|
|
348
|
+
},
|
|
270
349
|
"read-timeout" => {
|
|
271
350
|
type: Integer,
|
|
272
351
|
description: "How long to wait in seconds when making requests to the Orchestrator.",
|
|
@@ -343,6 +422,27 @@ module Bolt
|
|
|
343
422
|
_plugin: true,
|
|
344
423
|
_example: 445
|
|
345
424
|
},
|
|
425
|
+
"ssl-ca" => {
|
|
426
|
+
type: String,
|
|
427
|
+
description: "The path to the CA certificate for Choria TLS connections. Overrides the CA " \
|
|
428
|
+
"from the Choria client configuration file.",
|
|
429
|
+
_plugin: true,
|
|
430
|
+
_example: "/etc/choria/ssl/ca.pem"
|
|
431
|
+
},
|
|
432
|
+
"ssl-cert" => {
|
|
433
|
+
type: String,
|
|
434
|
+
description: "The path to the client certificate for Choria TLS connections. Overrides the " \
|
|
435
|
+
"certificate from the Choria client configuration file.",
|
|
436
|
+
_plugin: true,
|
|
437
|
+
_example: "/etc/choria/ssl/client.pem"
|
|
438
|
+
},
|
|
439
|
+
"ssl-key" => {
|
|
440
|
+
type: String,
|
|
441
|
+
description: "The path to the client private key for Choria TLS connections. Overrides the " \
|
|
442
|
+
"key from the Choria client configuration file.",
|
|
443
|
+
_plugin: true,
|
|
444
|
+
_example: "/etc/choria/ssl/client-key.pem"
|
|
445
|
+
},
|
|
346
446
|
"ssh-command" => {
|
|
347
447
|
type: [Array, String],
|
|
348
448
|
description: "The command and options to use when SSHing. This option is used when you need support for " \
|
|
@@ -393,6 +493,14 @@ module Bolt
|
|
|
393
493
|
_default: "production",
|
|
394
494
|
_example: "development"
|
|
395
495
|
},
|
|
496
|
+
"task-timeout" => {
|
|
497
|
+
type: Integer,
|
|
498
|
+
description: "How long to wait in seconds for tasks to complete when using the Choria transport.",
|
|
499
|
+
minimum: 1,
|
|
500
|
+
_plugin: true,
|
|
501
|
+
_default: 300,
|
|
502
|
+
_example: 300
|
|
503
|
+
},
|
|
396
504
|
"tmpdir" => {
|
|
397
505
|
type: String,
|
|
398
506
|
description: "The directory to upload and execute temporary files on the target.",
|
data/lib/bolt/executor.rb
CHANGED
|
@@ -13,6 +13,7 @@ require_relative '../bolt/puppetdb'
|
|
|
13
13
|
require_relative '../bolt/result'
|
|
14
14
|
require_relative '../bolt/result_set'
|
|
15
15
|
# Load transports
|
|
16
|
+
require_relative '../bolt/transport/choria'
|
|
16
17
|
require_relative '../bolt/transport/docker'
|
|
17
18
|
require_relative '../bolt/transport/jail'
|
|
18
19
|
require_relative '../bolt/transport/local'
|
|
@@ -24,6 +25,7 @@ require_relative '../bolt/transport/winrm'
|
|
|
24
25
|
|
|
25
26
|
module Bolt
|
|
26
27
|
TRANSPORTS = {
|
|
28
|
+
choria: Bolt::Transport::Choria,
|
|
27
29
|
docker: Bolt::Transport::Docker,
|
|
28
30
|
jail: Bolt::Transport::Jail,
|
|
29
31
|
local: Bolt::Transport::Local,
|
data/lib/bolt/outputter/human.rb
CHANGED
|
@@ -486,7 +486,7 @@ module Bolt
|
|
|
486
486
|
#
|
|
487
487
|
# @param topics [Array] The available topics.
|
|
488
488
|
#
|
|
489
|
-
def print_topics(topics
|
|
489
|
+
def print_topics(topics:)
|
|
490
490
|
info = +"#{colorize(:cyan, 'Topics')}\n"
|
|
491
491
|
info << indent(2, topics.join("\n"))
|
|
492
492
|
info << "\n\n#{colorize(:cyan, 'Additional information')}\n"
|
data/lib/bolt/outputter/json.rb
CHANGED
|
@@ -122,8 +122,8 @@ module Bolt
|
|
|
122
122
|
#
|
|
123
123
|
# @param topics [Array] The available topics.
|
|
124
124
|
#
|
|
125
|
-
def print_topics(
|
|
126
|
-
print_table(
|
|
125
|
+
def print_topics(topics:)
|
|
126
|
+
print_table({ topics: topics })
|
|
127
127
|
end
|
|
128
128
|
|
|
129
129
|
# Print the guide for the specified topic.
|
|
@@ -104,7 +104,11 @@ module Bolt
|
|
|
104
104
|
@stream.puts colorize(:rainbow, guide)
|
|
105
105
|
end
|
|
106
106
|
|
|
107
|
-
|
|
107
|
+
# Print available guide topics.
|
|
108
|
+
#
|
|
109
|
+
# @param topics [Array] The available topics.
|
|
110
|
+
#
|
|
111
|
+
def print_topics(topics:)
|
|
108
112
|
content = String.new("Available topics are:\n")
|
|
109
113
|
content += topics.join("\n")
|
|
110
114
|
content += "\n\nUse `bolt guide <topic>` to view a specific guide."
|
|
@@ -22,7 +22,7 @@ module Bolt
|
|
|
22
22
|
|
|
23
23
|
plan_object = parse_plan
|
|
24
24
|
param_descriptions = plan_object.parameters.map do |param|
|
|
25
|
-
str =
|
|
25
|
+
str = "# @param #{param.name}"
|
|
26
26
|
str << " #{param.description}" if param.description
|
|
27
27
|
str
|
|
28
28
|
end.join("\n")
|
data/lib/bolt/plugin/puppetdb.rb
CHANGED
|
@@ -5,7 +5,7 @@ module Bolt
|
|
|
5
5
|
class Puppetdb
|
|
6
6
|
class FactLookupError < Bolt::Error
|
|
7
7
|
def initialize(fact, err = nil)
|
|
8
|
-
m =
|
|
8
|
+
m = "Fact lookup '#{fact}' contains an invalid factname"
|
|
9
9
|
m << ": #{err}" unless err.nil?
|
|
10
10
|
super(m, 'bolt.plugin/fact-lookup-error')
|
|
11
11
|
end
|
data/lib/bolt/plugin.rb
CHANGED
|
@@ -127,7 +127,7 @@ module Bolt
|
|
|
127
127
|
end
|
|
128
128
|
end
|
|
129
129
|
|
|
130
|
-
RUBY_PLUGINS = %w[task prompt env_var puppetdb
|
|
130
|
+
RUBY_PLUGINS = %w[task prompt env_var puppetdb].freeze
|
|
131
131
|
BUILTIN_PLUGINS = %w[task terraform pkcs7 prompt vault aws_inventory puppetdb azure_inventory
|
|
132
132
|
yaml env_var gcloud_inventory].freeze
|
|
133
133
|
DEFAULT_PLUGIN_HOOKS = { 'puppet_library' => { 'plugin' => 'openvox_bootstrap', 'stop_service' => true } }.freeze
|
|
@@ -255,9 +255,6 @@ module Bolt
|
|
|
255
255
|
hooks = KNOWN_HOOKS.map { |hook| [hook, {}] }.to_h
|
|
256
256
|
|
|
257
257
|
@plugins.sort.each do |name, plugin|
|
|
258
|
-
# Don't show the Puppet Connect plugin for now.
|
|
259
|
-
next if name == 'puppet_connect_data'
|
|
260
|
-
|
|
261
258
|
case plugin
|
|
262
259
|
when Bolt::Plugin::Module
|
|
263
260
|
plugin.hook_map.each do |hook, spec|
|
data/lib/bolt/puppetdb/config.rb
CHANGED
|
@@ -149,6 +149,14 @@ module Bolt
|
|
|
149
149
|
@settings['key']
|
|
150
150
|
end
|
|
151
151
|
|
|
152
|
+
def headers
|
|
153
|
+
if @settings['headers'] && !@settings['headers'].is_a?(Hash)
|
|
154
|
+
raise Bolt::PuppetDBError, "headers must be a Hash"
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
@settings['headers']
|
|
158
|
+
end
|
|
159
|
+
|
|
152
160
|
def validate_cert_and_key
|
|
153
161
|
if (@settings['cert'] && !@settings['key']) ||
|
|
154
162
|
(!@settings['cert'] && @settings['key'])
|
data/lib/bolt/result_set.rb
CHANGED
|
@@ -27,7 +27,7 @@ module Bolt
|
|
|
27
27
|
|
|
28
28
|
def iterator
|
|
29
29
|
if Object.const_defined?(:Puppet) && Puppet.const_defined?(:Pops) &&
|
|
30
|
-
self.class.
|
|
30
|
+
self.class.include?(Puppet::Pops::Types::Iterable)
|
|
31
31
|
Puppet::Pops::Types::Iterable.on(@results, Bolt::Result)
|
|
32
32
|
else
|
|
33
33
|
raise NotImplementedError, "iterator requires puppet code to be loaded."
|