bolt 3.15.0 → 3.18.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 +7 -7
- data/bolt-modules/boltlib/lib/puppet/functions/run_script.rb +1 -4
- data/bolt-modules/boltlib/lib/puppet/functions/upload_file.rb +1 -4
- data/bolt-modules/file/lib/puppet/functions/file/exists.rb +1 -4
- data/bolt-modules/file/lib/puppet/functions/file/read.rb +1 -4
- data/bolt-modules/file/lib/puppet/functions/file/readable.rb +1 -4
- data/lib/bolt/analytics.rb +4 -21
- data/lib/bolt/application.rb +627 -0
- data/lib/bolt/applicator.rb +7 -6
- data/lib/bolt/apply_inventory.rb +3 -3
- data/lib/bolt/apply_result.rb +2 -2
- data/lib/bolt/bolt_option_parser.rb +27 -3
- data/lib/bolt/catalog.rb +10 -11
- data/lib/bolt/cli.rb +607 -809
- data/lib/bolt/config/modulepath.rb +1 -1
- data/lib/bolt/config/options.rb +32 -13
- data/lib/bolt/config/transport/base.rb +4 -4
- data/lib/bolt/config/transport/docker.rb +2 -2
- data/lib/bolt/config/transport/local.rb +2 -2
- data/lib/bolt/config/transport/lxd.rb +2 -2
- data/lib/bolt/config/transport/orch.rb +2 -2
- data/lib/bolt/config/transport/podman.rb +2 -2
- data/lib/bolt/config/transport/remote.rb +2 -2
- data/lib/bolt/config/transport/ssh.rb +2 -2
- data/lib/bolt/config/transport/winrm.rb +2 -2
- data/lib/bolt/config.rb +5 -5
- data/lib/bolt/container_result.rb +2 -2
- data/lib/bolt/error.rb +1 -1
- data/lib/bolt/executor.rb +17 -14
- data/lib/bolt/fiber_executor.rb +9 -5
- data/lib/bolt/inventory/group.rb +4 -4
- data/lib/bolt/inventory/inventory.rb +64 -41
- data/lib/bolt/inventory/options.rb +1 -1
- data/lib/bolt/inventory/target.rb +1 -1
- data/lib/bolt/inventory.rb +10 -17
- data/lib/bolt/module_installer/installer.rb +2 -2
- data/lib/bolt/module_installer/puppetfile/forge_module.rb +1 -1
- data/lib/bolt/module_installer/puppetfile/git_module.rb +1 -1
- data/lib/bolt/module_installer/puppetfile/module.rb +1 -1
- data/lib/bolt/module_installer/puppetfile.rb +27 -13
- data/lib/bolt/module_installer/resolver.rb +3 -3
- data/lib/bolt/module_installer/specs/forge_spec.rb +1 -1
- data/lib/bolt/module_installer/specs/git_spec.rb +1 -1
- data/lib/bolt/module_installer/specs.rb +3 -3
- data/lib/bolt/module_installer.rb +6 -6
- data/lib/bolt/node/errors.rb +1 -1
- data/lib/bolt/node/output.rb +1 -1
- data/lib/bolt/outputter/human.rb +85 -34
- data/lib/bolt/outputter/json.rb +63 -38
- data/lib/bolt/outputter/logger.rb +1 -1
- data/lib/bolt/outputter/rainbow.rb +1 -1
- data/lib/bolt/outputter.rb +4 -4
- data/lib/bolt/pal/logging.rb +1 -1
- data/lib/bolt/pal/yaml_plan/evaluator.rb +1 -1
- data/lib/bolt/pal/yaml_plan/loader.rb +2 -2
- data/lib/bolt/pal/yaml_plan/step.rb +11 -11
- data/lib/bolt/pal/yaml_plan/transpiler.rb +3 -3
- data/lib/bolt/pal/yaml_plan.rb +2 -2
- data/lib/bolt/pal.rb +11 -11
- data/lib/bolt/plan_creator.rb +88 -29
- data/lib/bolt/plan_future.rb +11 -6
- data/lib/bolt/plan_result.rb +3 -3
- data/lib/bolt/plugin/cache.rb +2 -2
- data/lib/bolt/plugin/module.rb +1 -1
- data/lib/bolt/plugin.rb +18 -24
- data/lib/bolt/project.rb +4 -11
- data/lib/bolt/project_manager/config_migrator.rb +1 -1
- data/lib/bolt/project_manager/inventory_migrator.rb +1 -1
- data/lib/bolt/project_manager/migrator.rb +1 -1
- data/lib/bolt/project_manager/module_migrator.rb +5 -5
- data/lib/bolt/project_manager.rb +23 -4
- data/lib/bolt/puppetdb/config.rb +1 -1
- data/lib/bolt/puppetdb.rb +3 -3
- data/lib/bolt/result.rb +1 -1
- data/lib/bolt/result_set.rb +2 -1
- data/lib/bolt/shell/bash.rb +12 -2
- data/lib/bolt/shell/powershell.rb +9 -2
- data/lib/bolt/shell.rb +2 -2
- data/lib/bolt/target.rb +2 -2
- data/lib/bolt/transport/base.rb +1 -1
- data/lib/bolt/transport/docker/connection.rb +1 -1
- data/lib/bolt/transport/docker.rb +2 -2
- data/lib/bolt/transport/local/connection.rb +19 -3
- data/lib/bolt/transport/local.rb +3 -3
- data/lib/bolt/transport/lxd/connection.rb +1 -1
- data/lib/bolt/transport/lxd.rb +4 -4
- data/lib/bolt/transport/orch/connection.rb +13 -1
- data/lib/bolt/transport/orch.rb +2 -2
- data/lib/bolt/transport/podman/connection.rb +1 -1
- data/lib/bolt/transport/podman.rb +2 -2
- data/lib/bolt/transport/remote.rb +2 -2
- data/lib/bolt/transport/simple.rb +3 -3
- data/lib/bolt/transport/ssh/connection.rb +3 -3
- data/lib/bolt/transport/ssh.rb +5 -5
- data/lib/bolt/transport/winrm/connection.rb +2 -2
- data/lib/bolt/transport/winrm.rb +3 -3
- data/lib/bolt/util.rb +8 -31
- data/lib/bolt/validator.rb +1 -1
- data/lib/bolt/version.rb +1 -1
- data/lib/bolt.rb +1 -1
- data/lib/bolt_server/file_cache.rb +12 -0
- data/lib/bolt_server/schemas/action-apply.json +32 -0
- data/lib/bolt_server/schemas/action-apply_prep.json +19 -0
- data/lib/bolt_server/transport_app.rb +129 -26
- data/lib/bolt_spec/bolt_context.rb +7 -5
- data/lib/bolt_spec/plans/mock_executor.rb +3 -3
- data/lib/bolt_spec/run.rb +1 -1
- data/libexec/bolt_catalog +1 -1
- metadata +7 -5
- data/lib/bolt/secret.rb +0 -37
data/lib/bolt/config/options.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
3
|
+
require_relative '../../bolt/config/transport/docker'
|
4
|
+
require_relative '../../bolt/config/transport/local'
|
5
|
+
require_relative '../../bolt/config/transport/lxd'
|
6
|
+
require_relative '../../bolt/config/transport/orch'
|
7
|
+
require_relative '../../bolt/config/transport/podman'
|
8
|
+
require_relative '../../bolt/config/transport/remote'
|
9
|
+
require_relative '../../bolt/config/transport/ssh'
|
10
|
+
require_relative '../../bolt/config/transport/winrm'
|
11
11
|
|
12
12
|
module Bolt
|
13
13
|
class Config
|
@@ -147,14 +147,23 @@ module Bolt
|
|
147
147
|
type: Hash,
|
148
148
|
properties: {
|
149
149
|
"file_paths" => {
|
150
|
-
description: "Load scripts from the `scripts/` directory of a module",
|
150
|
+
description: "Load scripts from the `scripts/` directory of a module.",
|
151
|
+
type: [TrueClass, FalseClass],
|
152
|
+
_example: true,
|
153
|
+
_default: false,
|
154
|
+
_deprecation: "Bolt no longer honors this option and enables loading scripts from the scripts "\
|
155
|
+
"directory by default."
|
156
|
+
},
|
157
|
+
"script_interpreter" => {
|
158
|
+
description: "Use a target's [`interpreters` configuration](bolt_transports_reference.md#interpreters) "\
|
159
|
+
"when running a script.",
|
151
160
|
type: [TrueClass, FalseClass],
|
152
161
|
_example: true,
|
153
162
|
_default: false
|
154
163
|
}
|
155
164
|
},
|
156
165
|
_plugin: false,
|
157
|
-
_example: { '
|
166
|
+
_example: { 'script_interpreter' => true }
|
158
167
|
},
|
159
168
|
"hiera-config" => {
|
160
169
|
description: "The path to the Hiera configuration file.",
|
@@ -248,10 +257,16 @@ module Bolt
|
|
248
257
|
type: Hash,
|
249
258
|
properties: {
|
250
259
|
"forge" => {
|
251
|
-
description: "A subsection
|
252
|
-
"operations only, and a `baseurl` setting to specify a different Forge host.",
|
260
|
+
description: "A subsection for configuring connections to a Forge host.",
|
253
261
|
type: Hash,
|
254
262
|
properties: {
|
263
|
+
"authorization_token" => {
|
264
|
+
description: "The token used to authorize requests to the Forge host. Must also specify "\
|
265
|
+
"`baseurl` when using this option.",
|
266
|
+
type: String,
|
267
|
+
_example: "Bearer eyJhbGciOiJIUzI1NiIsInR5c...",
|
268
|
+
_plugin: true
|
269
|
+
},
|
255
270
|
"baseurl" => {
|
256
271
|
description: "The URL to the Forge host.",
|
257
272
|
type: String,
|
@@ -265,7 +280,11 @@ module Bolt
|
|
265
280
|
_example: "https://my-forge-proxy.com:8080"
|
266
281
|
}
|
267
282
|
},
|
268
|
-
_example: {
|
283
|
+
_example: {
|
284
|
+
"authorization_token" => "Bearer eyJhbGciOiJIUzI1NiIsInR5c...",
|
285
|
+
"baseurl" => "https://forge.example.com",
|
286
|
+
"proxy" => "https://my-forge-proxy.com:8080"
|
287
|
+
}
|
269
288
|
},
|
270
289
|
"proxy" => {
|
271
290
|
description: "The HTTP proxy to use for Git and Forge operations.",
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
require_relative '../../../bolt/error'
|
4
|
+
require_relative '../../../bolt/util'
|
5
|
+
require_relative '../../../bolt/validator'
|
6
|
+
require_relative '../../../bolt/config/transport/options'
|
7
7
|
|
8
8
|
module Bolt
|
9
9
|
class Config
|
data/lib/bolt/config.rb
CHANGED
@@ -3,11 +3,11 @@
|
|
3
3
|
require 'etc'
|
4
4
|
require 'logging'
|
5
5
|
require 'pathname'
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
6
|
+
require_relative '../bolt/project'
|
7
|
+
require_relative '../bolt/logger'
|
8
|
+
require_relative '../bolt/util'
|
9
|
+
require_relative 'config/options'
|
10
|
+
require_relative '../bolt/validator'
|
11
11
|
|
12
12
|
module Bolt
|
13
13
|
class UnknownTransportError < Bolt::Error
|
data/lib/bolt/error.rb
CHANGED
data/lib/bolt/executor.rb
CHANGED
@@ -6,21 +6,21 @@ require 'json'
|
|
6
6
|
require 'logging'
|
7
7
|
require 'pathname'
|
8
8
|
require 'set'
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
9
|
+
require_relative '../bolt/analytics'
|
10
|
+
require_relative '../bolt/config'
|
11
|
+
require_relative '../bolt/fiber_executor'
|
12
|
+
require_relative '../bolt/puppetdb'
|
13
|
+
require_relative '../bolt/result'
|
14
|
+
require_relative '../bolt/result_set'
|
15
15
|
# Load transports
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
16
|
+
require_relative '../bolt/transport/docker'
|
17
|
+
require_relative '../bolt/transport/local'
|
18
|
+
require_relative '../bolt/transport/lxd'
|
19
|
+
require_relative '../bolt/transport/orch'
|
20
|
+
require_relative '../bolt/transport/podman'
|
21
|
+
require_relative '../bolt/transport/remote'
|
22
|
+
require_relative '../bolt/transport/ssh'
|
23
|
+
require_relative '../bolt/transport/winrm'
|
24
24
|
|
25
25
|
module Bolt
|
26
26
|
TRANSPORTS = {
|
@@ -300,6 +300,9 @@ module Bolt
|
|
300
300
|
description = options.fetch(:description, "script #{script}")
|
301
301
|
log_action(description, targets) do
|
302
302
|
options[:run_as] = run_as if run_as && !options.key?(:run_as)
|
303
|
+
options[:script_interpreter] = (future || {}).fetch('script_interpreter', false)
|
304
|
+
|
305
|
+
@analytics&.event('Future', 'script_interpreter', label: options[:script_interpreter].to_s)
|
303
306
|
|
304
307
|
batch_execute(targets) do |transport, batch|
|
305
308
|
with_node_logging("Running script #{script} with '#{arguments.to_json}'", batch) do
|
data/lib/bolt/fiber_executor.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
require_relative '../bolt/logger'
|
4
|
+
require_relative '../bolt/plan_future'
|
5
5
|
|
6
6
|
module Bolt
|
7
7
|
class FiberExecutor
|
@@ -52,7 +52,7 @@ module Bolt
|
|
52
52
|
# tracking which Futures to wait on when `wait()` is called without
|
53
53
|
# arguments.
|
54
54
|
@id += 1
|
55
|
-
future = Bolt::PlanFuture.new(future, @id, name: name, plan_id: plan_id)
|
55
|
+
future = Bolt::PlanFuture.new(future, @id, name: name, plan_id: plan_id, scope: newscope)
|
56
56
|
@logger.trace("Created future #{future.name}")
|
57
57
|
|
58
58
|
# Register the PlanFuture with the FiberExecutor to be executed
|
@@ -68,11 +68,15 @@ module Bolt
|
|
68
68
|
#
|
69
69
|
def round_robin
|
70
70
|
active_futures.each do |future|
|
71
|
-
# If the Fiber is still running and can be resumed, then resume it
|
71
|
+
# If the Fiber is still running and can be resumed, then resume it.
|
72
|
+
# Override Puppet's global_scope to prevent ephemerals in other scopes
|
73
|
+
# from being popped off in the wrong order due to race conditions.
|
74
|
+
# This primarily happens when running executor functions from custom
|
75
|
+
# Puppet language functions, but may happen elsewhere.
|
72
76
|
@logger.trace("Checking future '#{future.name}'")
|
73
77
|
if future.alive?
|
74
78
|
@logger.trace("Resuming future '#{future.name}'")
|
75
|
-
future.resume
|
79
|
+
Puppet.override(global_scope: future.scope) { future.resume }
|
76
80
|
end
|
77
81
|
|
78
82
|
# Once we've restarted the Fiber, check to see if it's finished again
|
data/lib/bolt/inventory/group.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
require_relative '../../bolt/config/options'
|
4
|
+
require_relative '../../bolt/inventory/group'
|
5
|
+
require_relative '../../bolt/inventory/inventory'
|
6
|
+
require_relative '../../bolt/inventory/target'
|
7
7
|
|
8
8
|
module Bolt
|
9
9
|
class Inventory
|
@@ -1,12 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
require_relative '../../bolt/inventory/group'
|
4
|
+
require_relative '../../bolt/inventory/target'
|
5
5
|
|
6
6
|
module Bolt
|
7
7
|
class Inventory
|
8
8
|
class Inventory
|
9
|
-
attr_reader :
|
9
|
+
attr_reader :plugins, :source, :targets, :transport
|
10
10
|
|
11
11
|
class WildcardError < Bolt::Error
|
12
12
|
def initialize(target)
|
@@ -14,25 +14,15 @@ module Bolt
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
# TODO: Pass transport config instead of config object
|
18
17
|
def initialize(data, transport, transports, plugins, source = nil)
|
19
|
-
@logger
|
20
|
-
@data
|
21
|
-
@transport
|
22
|
-
@config
|
23
|
-
@
|
24
|
-
@
|
25
|
-
@
|
26
|
-
@
|
27
|
-
@source = source
|
28
|
-
|
29
|
-
@groups.resolve_string_targets(@groups.target_aliases, @groups.all_targets)
|
30
|
-
|
31
|
-
collect_groups
|
32
|
-
end
|
33
|
-
|
34
|
-
def validate
|
35
|
-
@groups.validate
|
18
|
+
@logger = Bolt::Logger.logger(self)
|
19
|
+
@data = data || {}
|
20
|
+
@transport = transport
|
21
|
+
@config = transports
|
22
|
+
@config_resolved = transports.values.all?(&:resolved?)
|
23
|
+
@plugins = plugins
|
24
|
+
@targets = {}
|
25
|
+
@source = source
|
36
26
|
end
|
37
27
|
|
38
28
|
def version
|
@@ -43,13 +33,46 @@ module Bolt
|
|
43
33
|
Bolt::Target
|
44
34
|
end
|
45
35
|
|
46
|
-
|
47
|
-
|
48
|
-
|
36
|
+
# Load and resolve the groups in the inventory. Loading groups resolves
|
37
|
+
# all plugin references except for those for target data and config.
|
38
|
+
#
|
39
|
+
# @return [Bolt::Inventory::Group]
|
40
|
+
#
|
41
|
+
def groups
|
42
|
+
@groups ||= Group.new(@data, @plugins, all_group: true).tap do |groups|
|
43
|
+
groups.resolve_string_targets(groups.target_aliases, groups.all_targets)
|
44
|
+
groups.validate
|
45
|
+
end
|
49
46
|
end
|
50
47
|
|
48
|
+
# Return a list of all group names in the inventory.
|
49
|
+
#
|
50
|
+
# @return [Array[String]]
|
51
|
+
#
|
51
52
|
def group_names
|
52
|
-
|
53
|
+
group_lookup.keys
|
54
|
+
end
|
55
|
+
|
56
|
+
# Return a map of all groups in the inventory.
|
57
|
+
#
|
58
|
+
# @return [Hash[String, Bolt::Inventory::Group]]
|
59
|
+
#
|
60
|
+
def group_lookup
|
61
|
+
@group_lookup ||= groups.collect_groups
|
62
|
+
end
|
63
|
+
|
64
|
+
# Return a map of transport configuration for the inventory. Any
|
65
|
+
# unresolved plugin references are resolved.
|
66
|
+
#
|
67
|
+
# @return [Hash[String, Bolt::Config::Transport]]
|
68
|
+
#
|
69
|
+
def config
|
70
|
+
if @config_resolved
|
71
|
+
@config
|
72
|
+
else
|
73
|
+
@config_resolved = true
|
74
|
+
@config.transform_values! { |t| t.resolved? ? t : t.resolve(@plugins) }
|
75
|
+
end
|
53
76
|
end
|
54
77
|
|
55
78
|
def group_names_for(target_name)
|
@@ -57,7 +80,7 @@ module Bolt
|
|
57
80
|
end
|
58
81
|
|
59
82
|
def target_names
|
60
|
-
|
83
|
+
groups.all_targets
|
61
84
|
end
|
62
85
|
# alias for analytics
|
63
86
|
alias node_names target_names
|
@@ -81,7 +104,7 @@ module Bolt
|
|
81
104
|
|
82
105
|
#### PRIVATE ####
|
83
106
|
def group_data_for(target_name)
|
84
|
-
|
107
|
+
groups.group_collect(target_name)
|
85
108
|
end
|
86
109
|
|
87
110
|
# If target is a group name, expand it to the members of that group.
|
@@ -89,15 +112,15 @@ module Bolt
|
|
89
112
|
# If a wildcard string, error if no matches are found.
|
90
113
|
# Else fall back to [target] if no matches are found.
|
91
114
|
def resolve_name(target)
|
92
|
-
if (group =
|
115
|
+
if (group = group_lookup[target])
|
93
116
|
group.all_targets
|
94
117
|
else
|
95
118
|
# Try to wildcard match targets in inventory
|
96
119
|
# Ignore case because hostnames are generally case-insensitive
|
97
120
|
regexp = Regexp.new("^#{Regexp.escape(target).gsub('\*', '.*?')}$", Regexp::IGNORECASE)
|
98
121
|
|
99
|
-
targets =
|
100
|
-
targets +=
|
122
|
+
targets = groups.all_targets.select { |targ| targ =~ regexp }
|
123
|
+
targets += groups.target_aliases.select { |target_alias, _target| target_alias =~ regexp }.values
|
101
124
|
|
102
125
|
if targets.empty?
|
103
126
|
raise(WildcardError, target) if target.include?('*')
|
@@ -165,7 +188,7 @@ module Bolt
|
|
165
188
|
# associated references. This is used when a target is resolved by
|
166
189
|
# get_targets.
|
167
190
|
def create_target_from_inventory(target_name)
|
168
|
-
target_data =
|
191
|
+
target_data = groups.target_collect(target_name) || { 'uri' => target_name }
|
169
192
|
|
170
193
|
target = Bolt::Inventory::Target.new(target_data, self)
|
171
194
|
@targets[target.name] = target
|
@@ -187,24 +210,24 @@ module Bolt
|
|
187
210
|
@targets[new_target.name] = new_target
|
188
211
|
|
189
212
|
if existing_target
|
190
|
-
clear_alia_from_group(
|
213
|
+
clear_alia_from_group(groups, new_target.name)
|
191
214
|
else
|
192
215
|
add_to_group([new_target], 'all')
|
193
216
|
end
|
194
217
|
|
195
218
|
if new_target.target_alias
|
196
|
-
|
219
|
+
groups.insert_alia(new_target.name, Array(new_target.target_alias))
|
197
220
|
end
|
198
221
|
|
199
222
|
new_target
|
200
223
|
end
|
201
224
|
|
202
225
|
def validate_target_from_hash(target)
|
203
|
-
|
204
|
-
|
226
|
+
used_groups = Set.new(group_names)
|
227
|
+
used_targets = target_names
|
205
228
|
|
206
229
|
# Make sure there are no group name conflicts
|
207
|
-
if
|
230
|
+
if used_groups.include?(target.name)
|
208
231
|
raise ValidationError.new("Target name #{target.name} conflicts with group of the same name", nil)
|
209
232
|
end
|
210
233
|
|
@@ -217,11 +240,11 @@ module Bolt
|
|
217
240
|
end
|
218
241
|
|
219
242
|
# Make sure there are no conflicts with the new target aliases
|
220
|
-
used_aliases =
|
243
|
+
used_aliases = groups.target_aliases
|
221
244
|
Array(target.target_alias).each do |alia|
|
222
|
-
if
|
245
|
+
if used_groups.include?(alia)
|
223
246
|
raise ValidationError.new("Alias #{alia} conflicts with group of the same name", nil)
|
224
|
-
elsif
|
247
|
+
elsif used_targets.include?(alia)
|
225
248
|
raise ValidationError.new("Alias #{alia} conflicts with target of the same name", nil)
|
226
249
|
elsif used_aliases[alia] && used_aliases[alia] != target.name
|
227
250
|
raise ValidationError.new(
|
@@ -250,7 +273,7 @@ module Bolt
|
|
250
273
|
end
|
251
274
|
|
252
275
|
if group_names.include?(desired_group)
|
253
|
-
remove_target(
|
276
|
+
remove_target(groups, @targets[target.first.name], desired_group)
|
254
277
|
else
|
255
278
|
raise ValidationError.new("Group #{desired_group} does not exist in inventory", nil)
|
256
279
|
end
|
@@ -260,7 +283,7 @@ module Bolt
|
|
260
283
|
if group_names.include?(desired_group)
|
261
284
|
targets.each do |target|
|
262
285
|
# Add the inventory copy of the target
|
263
|
-
add_target(
|
286
|
+
add_target(groups, @targets[target.name], desired_group)
|
264
287
|
end
|
265
288
|
else
|
266
289
|
raise ValidationError.new("Group #{desired_group} does not exist in inventory", nil)
|
data/lib/bolt/inventory.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'set'
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
4
|
+
require_relative '../bolt/config'
|
5
|
+
require_relative 'inventory/group'
|
6
|
+
require_relative 'inventory/inventory'
|
7
|
+
require_relative 'inventory/options'
|
8
|
+
require_relative '../bolt/target'
|
9
|
+
require_relative '../bolt/util'
|
10
|
+
require_relative '../bolt/plugin'
|
11
|
+
require_relative '../bolt/validator'
|
12
12
|
require 'yaml'
|
13
13
|
|
14
14
|
module Bolt
|
@@ -91,19 +91,12 @@ module Bolt
|
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
94
|
-
# Resolve plugin references from transport config
|
95
|
-
config.transports.each_value do |t|
|
96
|
-
t.resolve(plugins) unless t.resolved?
|
97
|
-
end
|
98
|
-
|
99
94
|
Bolt::Validator.new.tap do |validator|
|
100
95
|
validator.validate(data, schema, source)
|
101
96
|
validator.warnings.each { |warning| Bolt::Logger.warn(warning[:id], warning[:msg]) }
|
102
97
|
end
|
103
98
|
|
104
|
-
|
105
|
-
inventory.validate
|
106
|
-
inventory
|
99
|
+
create_version(data, config.transport, config.transports, plugins, source)
|
107
100
|
end
|
108
101
|
|
109
102
|
def self.create_version(data, transport, transports, plugins, source = nil)
|
@@ -119,7 +112,7 @@ module Bolt
|
|
119
112
|
|
120
113
|
def self.empty
|
121
114
|
config = Bolt::Config.default
|
122
|
-
plugins = Bolt::Plugin.
|
115
|
+
plugins = Bolt::Plugin.new(config, nil)
|
123
116
|
|
124
117
|
create_version({}, config.transport, config.transports, plugins, nil)
|
125
118
|
end
|