openbolt 5.0.0.rc1 → 5.1.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 +18 -12
- data/bolt-modules/boltlib/lib/puppet/functions/apply_prep.rb +5 -3
- data/bolt-modules/boltlib/lib/puppet/functions/download_file.rb +1 -0
- data/bolt-modules/boltlib/lib/puppet/functions/get_resources.rb +2 -0
- data/bolt-modules/boltlib/lib/puppet/functions/puppetdb_command.rb +1 -1
- data/bolt-modules/boltlib/lib/puppet/functions/run_container.rb +2 -2
- data/bolt-modules/boltlib/lib/puppet/functions/run_script.rb +1 -0
- data/bolt-modules/boltlib/lib/puppet/functions/set_resources.rb +2 -2
- data/bolt-modules/boltlib/lib/puppet/functions/upload_file.rb +1 -0
- data/bolt-modules/boltlib/lib/puppet/functions/wait.rb +1 -1
- data/bolt-modules/boltlib/lib/puppet/functions/wait_until_available.rb +1 -0
- data/bolt-modules/ctrl/lib/puppet/functions/ctrl/do_until.rb +1 -0
- data/lib/bolt/analytics.rb +1 -1
- data/lib/bolt/application.rb +17 -22
- data/lib/bolt/applicator.rb +4 -0
- data/lib/bolt/bolt_option_parser.rb +10 -8
- data/lib/bolt/cli.rb +7 -6
- data/lib/bolt/config/options.rb +59 -67
- data/lib/bolt/config/transport/base.rb +1 -0
- data/lib/bolt/config/transport/options.rb +59 -59
- data/lib/bolt/config.rb +8 -6
- data/lib/bolt/executor.rb +9 -24
- data/lib/bolt/fiber_executor.rb +3 -1
- data/lib/bolt/inventory/group.rb +3 -0
- data/lib/bolt/inventory/inventory.rb +2 -0
- data/lib/bolt/inventory/options.rb +7 -7
- data/lib/bolt/inventory/target.rb +3 -2
- data/lib/bolt/inventory.rb +1 -0
- data/lib/bolt/logger.rb +2 -0
- data/lib/bolt/module.rb +1 -0
- data/lib/bolt/module_installer/puppetfile.rb +4 -4
- data/lib/bolt/module_installer/resolver.rb +2 -2
- data/lib/bolt/module_installer/specs/forge_spec.rb +4 -4
- data/lib/bolt/module_installer/specs/git_spec.rb +6 -6
- data/lib/bolt/module_installer/specs/id/gitclone.rb +1 -0
- data/lib/bolt/module_installer/specs/id/github.rb +2 -1
- data/lib/bolt/module_installer/specs/id/gitlab.rb +2 -1
- data/lib/bolt/module_installer.rb +3 -1
- data/lib/bolt/outputter/human.rb +9 -4
- data/lib/bolt/outputter/rainbow.rb +1 -0
- data/lib/bolt/pal/yaml_plan/parameter.rb +2 -2
- data/lib/bolt/pal/yaml_plan/step/resources.rb +1 -1
- data/lib/bolt/pal.rb +7 -4
- data/lib/bolt/plan_creator.rb +5 -4
- data/lib/bolt/plugin/cache.rb +2 -0
- data/lib/bolt/plugin/module.rb +7 -0
- data/lib/bolt/plugin/puppet_connect_data.rb +1 -0
- data/lib/bolt/plugin/task.rb +3 -0
- data/lib/bolt/plugin.rb +4 -0
- data/lib/bolt/project.rb +3 -3
- data/lib/bolt/project_manager/config_migrator.rb +3 -3
- data/lib/bolt/project_manager/inventory_migrator.rb +1 -1
- data/lib/bolt/project_manager/module_migrator.rb +7 -6
- data/lib/bolt/project_manager.rb +11 -11
- data/lib/bolt/puppetdb/config.rb +4 -0
- data/lib/bolt/puppetdb/instance.rb +1 -0
- data/lib/bolt/rerun.rb +1 -0
- data/lib/bolt/resource_instance.rb +1 -1
- data/lib/bolt/result.rb +2 -1
- data/lib/bolt/shell/bash.rb +2 -1
- data/lib/bolt/shell/powershell.rb +4 -3
- data/lib/bolt/shell.rb +1 -1
- data/lib/bolt/task/run.rb +1 -0
- data/lib/bolt/task.rb +3 -0
- data/lib/bolt/transport/docker/connection.rb +2 -0
- data/lib/bolt/transport/jail/connection.rb +2 -0
- data/lib/bolt/transport/lxd/connection.rb +2 -0
- data/lib/bolt/transport/lxd.rb +1 -1
- data/lib/bolt/transport/podman/connection.rb +2 -0
- data/lib/bolt/transport/remote.rb +1 -0
- data/lib/bolt/transport/ssh/connection.rb +1 -1
- data/lib/bolt/transport/winrm/connection.rb +4 -3
- data/lib/bolt/util/format.rb +1 -0
- data/lib/bolt/util.rb +7 -4
- data/lib/bolt/validator.rb +1 -1
- data/lib/bolt/version.rb +1 -1
- data/lib/bolt_spec/plans/action_stubs.rb +5 -0
- data/lib/bolt_spec/plans/mock_executor.rb +2 -4
- data/libexec/apply_catalog.rb +2 -1
- data/libexec/custom_facts.rb +1 -1
- data/libexec/query_resources.rb +1 -1
- metadata +63 -77
- data/lib/bolt/config/transport/orch.rb +0 -41
- data/lib/bolt/transport/orch/connection.rb +0 -111
- data/lib/bolt/transport/orch.rb +0 -271
- data/lib/bolt_server/acl.rb +0 -39
- data/lib/bolt_server/base_config.rb +0 -112
- data/lib/bolt_server/config.rb +0 -64
- data/lib/bolt_server/file_cache.rb +0 -200
- data/lib/bolt_server/request_error.rb +0 -11
- data/lib/bolt_server/schemas/action-check_node_connections.json +0 -14
- data/lib/bolt_server/schemas/action-run_command.json +0 -12
- data/lib/bolt_server/schemas/action-run_script.json +0 -47
- data/lib/bolt_server/schemas/action-run_task.json +0 -20
- data/lib/bolt_server/schemas/action-upload_file.json +0 -47
- data/lib/bolt_server/schemas/partials/target-any.json +0 -10
- data/lib/bolt_server/schemas/partials/target-ssh.json +0 -88
- data/lib/bolt_server/schemas/partials/target-winrm.json +0 -67
- data/lib/bolt_server/schemas/partials/task.json +0 -94
- data/lib/bolt_server/schemas/transport-ssh.json +0 -25
- data/lib/bolt_server/schemas/transport-winrm.json +0 -19
- data/lib/bolt_server/transport_app.rb +0 -554
data/lib/bolt/config.rb
CHANGED
|
@@ -101,7 +101,7 @@ module Bolt
|
|
|
101
101
|
|
|
102
102
|
Bolt::Logger.warn(
|
|
103
103
|
"unsupported_project_config",
|
|
104
|
-
"Unsupported project configuration detected in '#{filepath}': #{project_config.keys}. "\
|
|
104
|
+
"Unsupported project configuration detected in '#{filepath}': #{project_config.keys}. " \
|
|
105
105
|
"Project configuration should be set in 'bolt-project.yaml'."
|
|
106
106
|
)
|
|
107
107
|
end
|
|
@@ -114,8 +114,8 @@ module Bolt
|
|
|
114
114
|
|
|
115
115
|
Bolt::Logger.warn(
|
|
116
116
|
"unsupported_inventory_config",
|
|
117
|
-
"Unsupported inventory configuration detected in '#{filepath}': #{transport_config.keys}. "\
|
|
118
|
-
"Transport configuration should be set under the 'inventory-config' option or "\
|
|
117
|
+
"Unsupported inventory configuration detected in '#{filepath}': #{transport_config.keys}. " \
|
|
118
|
+
"Transport configuration should be set under the 'inventory-config' option or " \
|
|
119
119
|
"in 'inventory.yaml'."
|
|
120
120
|
)
|
|
121
121
|
end
|
|
@@ -126,13 +126,13 @@ module Bolt
|
|
|
126
126
|
if data.key?('inventory-config')
|
|
127
127
|
unless data['inventory-config'].is_a?(Hash)
|
|
128
128
|
raise Bolt::ValidationError,
|
|
129
|
-
"Option 'inventory-config' must be of type Hash, received #{data['inventory-config']} "\
|
|
129
|
+
"Option 'inventory-config' must be of type Hash, received #{data['inventory-config']} " \
|
|
130
130
|
"#{data['inventory-config']} (file: #{filepath})"
|
|
131
131
|
end
|
|
132
132
|
|
|
133
133
|
if data['inventory-config'].key?('_plugin')
|
|
134
134
|
raise Bolt::ValidationError,
|
|
135
|
-
"Found unsupported key '_plugin' for option 'inventory-config'; supported keys are "\
|
|
135
|
+
"Found unsupported key '_plugin' for option 'inventory-config'; supported keys are " \
|
|
136
136
|
"'#{INVENTORY_OPTIONS.keys.join("', '")}' (file: #{filepath})"
|
|
137
137
|
end
|
|
138
138
|
|
|
@@ -309,6 +309,7 @@ module Bolt
|
|
|
309
309
|
|
|
310
310
|
private def normalize_log(target)
|
|
311
311
|
return target if target == 'console'
|
|
312
|
+
|
|
312
313
|
target = target[5..-1] if target.start_with?('file:')
|
|
313
314
|
'file:' + File.expand_path(target, @project.path)
|
|
314
315
|
end
|
|
@@ -334,7 +335,7 @@ module Bolt
|
|
|
334
335
|
def validate
|
|
335
336
|
if @data['modulepath']&.include?(@project.managed_moduledir.to_s)
|
|
336
337
|
raise Bolt::ValidationError,
|
|
337
|
-
"Found invalid path in modulepath: #{@project.managed_moduledir}. This path "\
|
|
338
|
+
"Found invalid path in modulepath: #{@project.managed_moduledir}. This path " \
|
|
338
339
|
"is automatically appended to the modulepath and cannot be configured."
|
|
339
340
|
end
|
|
340
341
|
|
|
@@ -479,6 +480,7 @@ module Bolt
|
|
|
479
480
|
# Check if there is a case-insensitive match to the path
|
|
480
481
|
def check_path_case(type, paths)
|
|
481
482
|
return if paths.nil?
|
|
483
|
+
|
|
482
484
|
matches = matching_paths(paths)
|
|
483
485
|
|
|
484
486
|
if matches.any?
|
data/lib/bolt/executor.rb
CHANGED
|
@@ -17,7 +17,6 @@ require_relative '../bolt/transport/docker'
|
|
|
17
17
|
require_relative '../bolt/transport/jail'
|
|
18
18
|
require_relative '../bolt/transport/local'
|
|
19
19
|
require_relative '../bolt/transport/lxd'
|
|
20
|
-
require_relative '../bolt/transport/orch'
|
|
21
20
|
require_relative '../bolt/transport/podman'
|
|
22
21
|
require_relative '../bolt/transport/remote'
|
|
23
22
|
require_relative '../bolt/transport/ssh'
|
|
@@ -29,7 +28,6 @@ module Bolt
|
|
|
29
28
|
jail: Bolt::Transport::Jail,
|
|
30
29
|
local: Bolt::Transport::Local,
|
|
31
30
|
lxd: Bolt::Transport::LXD,
|
|
32
|
-
pcp: Bolt::Transport::Orch,
|
|
33
31
|
podman: Bolt::Transport::Podman,
|
|
34
32
|
remote: Bolt::Transport::Remote,
|
|
35
33
|
ssh: Bolt::Transport::SSH,
|
|
@@ -84,6 +82,7 @@ module Bolt
|
|
|
84
82
|
def transport(transport)
|
|
85
83
|
impl = @transports[transport || 'ssh']
|
|
86
84
|
raise(Bolt::UnknownTransportError, transport) unless impl
|
|
85
|
+
|
|
87
86
|
# If there was an error creating the transport, ensure it gets thrown
|
|
88
87
|
impl.no_error!
|
|
89
88
|
impl.value
|
|
@@ -107,6 +106,7 @@ module Bolt
|
|
|
107
106
|
# If types isn't set or if the subscriber is subscribed to
|
|
108
107
|
# that type of event, publish the event
|
|
109
108
|
next unless types.nil? || types.include?(event[:type])
|
|
109
|
+
|
|
110
110
|
@publisher.post(subscriber) do |sub|
|
|
111
111
|
# Wait for user to input to prompt before printing anything
|
|
112
112
|
sleep(0.1) while @prompting
|
|
@@ -129,10 +129,10 @@ module Bolt
|
|
|
129
129
|
def queue_execute(targets)
|
|
130
130
|
if @warn_concurrency && targets.length > @concurrency
|
|
131
131
|
@warn_concurrency = false
|
|
132
|
-
msg = "The ulimit is low, which might cause file limit issues. Default concurrency has been set to "\
|
|
133
|
-
"'#{@concurrency}' to mitigate those issues, which might cause Bolt to run slow. "\
|
|
134
|
-
"Disable this warning by configuring ulimit using 'ulimit -n <limit>' in your shell "\
|
|
135
|
-
"configuration, or by configuring Bolt's concurrency. "\
|
|
132
|
+
msg = "The ulimit is low, which might cause file limit issues. Default concurrency has been set to " \
|
|
133
|
+
"'#{@concurrency}' to mitigate those issues, which might cause Bolt to run slow. " \
|
|
134
|
+
"Disable this warning by configuring ulimit using 'ulimit -n <limit>' in your shell " \
|
|
135
|
+
"configuration, or by configuring Bolt's concurrency. " \
|
|
136
136
|
"See https://puppet.com/docs/bolt/latest/bolt_known_issues.html for details."
|
|
137
137
|
Bolt::Logger.warn("low_ulimit", msg)
|
|
138
138
|
end
|
|
@@ -169,6 +169,7 @@ module Bolt
|
|
|
169
169
|
# exception and some promise is still missing a result.
|
|
170
170
|
result_promises.each do |target, promise|
|
|
171
171
|
next if promise.fulfilled?
|
|
172
|
+
|
|
172
173
|
error = $ERROR_INFO || Bolt::Error.new("No result was returned for #{target.uri}",
|
|
173
174
|
"puppetlabs.bolt/missing-result-error")
|
|
174
175
|
promise.set(Bolt::Result.from_exception(target, error))
|
|
@@ -479,6 +480,7 @@ module Bolt
|
|
|
479
480
|
start = wait_now
|
|
480
481
|
until yield
|
|
481
482
|
raise(TimeoutError, 'Timed out waiting for target') if (wait_now - start).to_i >= timeout
|
|
483
|
+
|
|
482
484
|
sleep(retry_interval)
|
|
483
485
|
end
|
|
484
486
|
end
|
|
@@ -486,6 +488,7 @@ module Bolt
|
|
|
486
488
|
def prompt(prompt, options)
|
|
487
489
|
unless $stdin.tty?
|
|
488
490
|
return options[:default] if options[:default]
|
|
491
|
+
|
|
489
492
|
raise Bolt::Error.new('STDIN is not a tty, unable to prompt', 'bolt/no-tty-error')
|
|
490
493
|
end
|
|
491
494
|
|
|
@@ -511,24 +514,6 @@ module Bolt
|
|
|
511
514
|
value
|
|
512
515
|
end
|
|
513
516
|
|
|
514
|
-
# Plan context doesn't make sense for most transports but it is tightly
|
|
515
|
-
# coupled with the orchestrator transport since the transport behaves
|
|
516
|
-
# differently when a plan is running. In order to limit how much this
|
|
517
|
-
# pollutes the transport API we only handle the orchestrator transport here.
|
|
518
|
-
# Since we call this function without resolving targets this will result
|
|
519
|
-
# in the orchestrator transport always being initialized during plan runs.
|
|
520
|
-
# For now that's ok.
|
|
521
|
-
#
|
|
522
|
-
# In the future if other transports need this or if we want a plan stack
|
|
523
|
-
# we'll need to refactor.
|
|
524
|
-
def start_plan(plan_context)
|
|
525
|
-
transport('pcp').plan_context = plan_context
|
|
526
|
-
end
|
|
527
|
-
|
|
528
|
-
def finish_plan(plan_result)
|
|
529
|
-
transport('pcp').finish_plan(plan_result)
|
|
530
|
-
end
|
|
531
|
-
|
|
532
517
|
def without_default_logging
|
|
533
518
|
publish_event(type: :disable_default_output)
|
|
534
519
|
yield
|
data/lib/bolt/fiber_executor.rb
CHANGED
|
@@ -82,6 +82,7 @@ module Bolt
|
|
|
82
82
|
# Once we've restarted the Fiber, check to see if it's finished again
|
|
83
83
|
# and cleanup if it has.
|
|
84
84
|
next if future.alive?
|
|
85
|
+
|
|
85
86
|
@logger.trace("Cleaning up future '#{future.name}'")
|
|
86
87
|
|
|
87
88
|
# If the future errored and the main plan has already exited, log the
|
|
@@ -99,6 +100,7 @@ module Bolt
|
|
|
99
100
|
# execute before checking again. This mitigates CPU
|
|
100
101
|
# thrashing.
|
|
101
102
|
return unless active_futures.all? { |f| %i[returned_immediately unfinished].include?(f.value) }
|
|
103
|
+
|
|
102
104
|
@logger.trace("Nothing can be resumed. Rechecking in 0.5 seconds.")
|
|
103
105
|
|
|
104
106
|
sleep(0.5)
|
|
@@ -145,7 +147,7 @@ module Bolt
|
|
|
145
147
|
# futures being waited on.
|
|
146
148
|
until (futures = get_futures_for_plan(plan_id: plan_id)).map(&:alive?).none?
|
|
147
149
|
if futures.map(&:fiber).include?(Fiber.current)
|
|
148
|
-
msg = "The wait() function cannot be called with no arguments inside a "\
|
|
150
|
+
msg = "The wait() function cannot be called with no arguments inside a " \
|
|
149
151
|
"background block in the same plan."
|
|
150
152
|
raise Bolt::Error.new(msg, 'bolt/infinite-wait')
|
|
151
153
|
end
|
data/lib/bolt/inventory/group.rb
CHANGED
|
@@ -179,6 +179,7 @@ module Bolt
|
|
|
179
179
|
if (found = @aliases[alia])
|
|
180
180
|
raise ValidationError.new(alias_conflict(alia, found, target_name), @name)
|
|
181
181
|
end
|
|
182
|
+
|
|
182
183
|
@aliases[alia] = target_name
|
|
183
184
|
end
|
|
184
185
|
end
|
|
@@ -339,8 +340,10 @@ module Bolt
|
|
|
339
340
|
|
|
340
341
|
Bolt::Config::Options::TRANSPORT_CONFIG.each_key do |transport|
|
|
341
342
|
next unless result['config'].key?(transport)
|
|
343
|
+
|
|
342
344
|
transport_config = result['config'][transport]
|
|
343
345
|
next unless transport_config.is_a?(Hash)
|
|
346
|
+
|
|
344
347
|
transport_config = Bolt::Util.postwalk_vals(transport_config) do |val|
|
|
345
348
|
if val.is_a?(Hash)
|
|
346
349
|
val = val.compact
|
|
@@ -109,6 +109,7 @@ module Bolt
|
|
|
109
109
|
if target_array.count > 1
|
|
110
110
|
raise ValidationError.new("'#{target}' refers to #{target_array.count} targets", nil)
|
|
111
111
|
end
|
|
112
|
+
|
|
112
113
|
target_array.first
|
|
113
114
|
end
|
|
114
115
|
|
|
@@ -158,6 +159,7 @@ module Bolt
|
|
|
158
159
|
# Find groups that match the glob
|
|
159
160
|
group_lookup.each do |name, grp|
|
|
160
161
|
next unless match_wildcard?(target, name, ext_glob: ext_glob)
|
|
162
|
+
|
|
161
163
|
targets += grp.all_targets.to_a
|
|
162
164
|
end
|
|
163
165
|
|
|
@@ -21,7 +21,7 @@ module Bolt
|
|
|
21
21
|
# https://github.com/puppetlabs/bolt/blob/main/schemas/README.md
|
|
22
22
|
DEFINITIONS = {
|
|
23
23
|
"alias" => {
|
|
24
|
-
description: "A unique alias to refer to the target. Aliases cannot conflict "\
|
|
24
|
+
description: "A unique alias to refer to the target. Aliases cannot conflict " \
|
|
25
25
|
"with the name of a group, the name of a target, or another alias.",
|
|
26
26
|
type: [String, Array],
|
|
27
27
|
uniqueItems: true,
|
|
@@ -74,16 +74,16 @@ module Bolt
|
|
|
74
74
|
_plugin: true
|
|
75
75
|
},
|
|
76
76
|
"name" => {
|
|
77
|
-
description: "A human-readable name to refer to the group or target. Names "\
|
|
78
|
-
"cannot conflict with the name of a group, the name of a target, "\
|
|
79
|
-
"or the alias of a target. A name is required for a group and is "\
|
|
77
|
+
description: "A human-readable name to refer to the group or target. Names " \
|
|
78
|
+
"cannot conflict with the name of a group, the name of a target, " \
|
|
79
|
+
"or the alias of a target. A name is required for a group and is " \
|
|
80
80
|
"required for a target unless the uri option is set.",
|
|
81
81
|
type: String,
|
|
82
82
|
_plugin: true
|
|
83
83
|
},
|
|
84
84
|
"plugin_hooks" => {
|
|
85
|
-
description: "Configuration for the Puppet library plugin used to install the "\
|
|
86
|
-
"Puppet agent on the target. For more information, see "\
|
|
85
|
+
description: "Configuration for the Puppet library plugin used to install the " \
|
|
86
|
+
"Puppet agent on the target. For more information, see " \
|
|
87
87
|
"https://pup.pt/bolt-plugin-hooks",
|
|
88
88
|
type: Hash,
|
|
89
89
|
properties: {
|
|
@@ -115,7 +115,7 @@ module Bolt
|
|
|
115
115
|
_plugin: true
|
|
116
116
|
},
|
|
117
117
|
"uri" => {
|
|
118
|
-
description: "The URI of the target. This option is required unless the name "\
|
|
118
|
+
description: "The URI of the target. This option is required unless the name " \
|
|
119
119
|
"option is set.",
|
|
120
120
|
type: String,
|
|
121
121
|
format: "uri",
|
|
@@ -59,6 +59,7 @@ module Bolt
|
|
|
59
59
|
|
|
60
60
|
def set_local_defaults
|
|
61
61
|
return if @set_local_default
|
|
62
|
+
|
|
62
63
|
defaults = {
|
|
63
64
|
'local' => { 'interpreters' => { '.rb' => RbConfig.ruby } }
|
|
64
65
|
}
|
|
@@ -176,8 +177,8 @@ module Bolt
|
|
|
176
177
|
if (dotted = facts.keys.select { |name| name.include?('.') }).any?
|
|
177
178
|
Bolt::Logger.deprecate(
|
|
178
179
|
'dotted_fact_name',
|
|
179
|
-
"Target '#{safe_name}' includes dotted fact names: '#{dotted.join("', '")}'. Dotted fact "\
|
|
180
|
-
"names are deprecated and Bolt does not automatically convert facts with dotted names to "\
|
|
180
|
+
"Target '#{safe_name}' includes dotted fact names: '#{dotted.join("', '")}'. Dotted fact " \
|
|
181
|
+
"names are deprecated and Bolt does not automatically convert facts with dotted names to " \
|
|
181
182
|
"structured facts. For more information, see https://pup.pt/bolt-dotted-facts"
|
|
182
183
|
)
|
|
183
184
|
end
|
data/lib/bolt/inventory.rb
CHANGED
|
@@ -71,6 +71,7 @@ module Bolt
|
|
|
71
71
|
source = ENVIRONMENT_VAR
|
|
72
72
|
data = YAML.safe_load(ENV[ENVIRONMENT_VAR])
|
|
73
73
|
raise Bolt::ParseError, "Could not parse inventory from $#{ENVIRONMENT_VAR}" unless data.is_a?(Hash)
|
|
74
|
+
|
|
74
75
|
logger.debug("Loaded inventory from environment variable #{ENVIRONMENT_VAR}")
|
|
75
76
|
rescue Psych::Exception
|
|
76
77
|
raise Bolt::ParseError, "Could not parse inventory from $#{ENVIRONMENT_VAR}"
|
data/lib/bolt/logger.rb
CHANGED
|
@@ -231,11 +231,13 @@ module Bolt
|
|
|
231
231
|
#
|
|
232
232
|
private_class_method def self.do_warn(msg, id)
|
|
233
233
|
return if @disable_warnings.include?(id)
|
|
234
|
+
|
|
234
235
|
logger(self).warn(msg)
|
|
235
236
|
end
|
|
236
237
|
|
|
237
238
|
private_class_method def self.do_warn_once(msg, id)
|
|
238
239
|
return unless @warnings.add?(id)
|
|
240
|
+
|
|
239
241
|
do_warn(msg, id)
|
|
240
242
|
end
|
|
241
243
|
|
data/lib/bolt/module.rb
CHANGED
|
@@ -56,7 +56,7 @@ module Bolt
|
|
|
56
56
|
else
|
|
57
57
|
unless skip_unsupported_modules
|
|
58
58
|
raise Bolt::ValidationError,
|
|
59
|
-
"Cannot parse Puppetfile at #{path}, module '#{mod.title}' is not a "\
|
|
59
|
+
"Cannot parse Puppetfile at #{path}, module '#{mod.title}' is not a " \
|
|
60
60
|
"Puppet Forge or Git module."
|
|
61
61
|
end
|
|
62
62
|
end
|
|
@@ -105,7 +105,7 @@ module Bolt
|
|
|
105
105
|
Puppetfile does not include modules that satisfy the following specifications:
|
|
106
106
|
|
|
107
107
|
#{unsatisfied_specs.map(&:to_hash).to_yaml.lines.drop(1).join.chomp}
|
|
108
|
-
|
|
108
|
+
|
|
109
109
|
This Puppetfile might not be managed by Bolt. To forcibly overwrite the
|
|
110
110
|
Puppetfile, run '#{command}'.
|
|
111
111
|
MESSAGE
|
|
@@ -116,9 +116,9 @@ module Bolt
|
|
|
116
116
|
if versionless_mods.any?
|
|
117
117
|
message = <<~MESSAGE.chomp
|
|
118
118
|
Puppetfile includes Forge modules without a version requirement:
|
|
119
|
-
|
|
119
|
+
|
|
120
120
|
#{versionless_mods.map(&:to_spec).join.chomp}
|
|
121
|
-
|
|
121
|
+
|
|
122
122
|
This Puppetfile might not be managed by Bolt. To forcibly overwrite the
|
|
123
123
|
Puppetfile, run '#{command}'.
|
|
124
124
|
MESSAGE
|
|
@@ -98,8 +98,8 @@ module Bolt
|
|
|
98
98
|
# names, but we error early here to provide a more helpful message.
|
|
99
99
|
if (name_conflicts = modules.map(&:name) & unresolved.map(&:name)).any?
|
|
100
100
|
raise Bolt::Error.new(
|
|
101
|
-
"Detected unresolved module specifications with the same name as a resolved module "\
|
|
102
|
-
"dependency: #{name_conflicts.join(', ')}. Either remove the unresolved module specification "\
|
|
101
|
+
"Detected unresolved module specifications with the same name as a resolved module " \
|
|
102
|
+
"dependency: #{name_conflicts.join(', ')}. Either remove the unresolved module specification " \
|
|
103
103
|
"or set the module with the conflicting dependency to not resolve.",
|
|
104
104
|
"bolt/module-name-conflict-error"
|
|
105
105
|
)
|
|
@@ -38,9 +38,9 @@ module Bolt
|
|
|
38
38
|
private def parse_name(name)
|
|
39
39
|
unless (match = name.match(NAME_REGEX))
|
|
40
40
|
raise Bolt::ValidationError,
|
|
41
|
-
"Invalid name for Forge module specification: #{name}. Name must match "\
|
|
42
|
-
"'owner/name'. Owner segment can only include letters or digits. Name "\
|
|
43
|
-
"segment must start with a lowercase letter and can only include lowercase "\
|
|
41
|
+
"Invalid name for Forge module specification: #{name}. Name must match " \
|
|
42
|
+
"'owner/name'. Owner segment can only include letters or digits. Name " \
|
|
43
|
+
"segment must start with a lowercase letter and can only include lowercase " \
|
|
44
44
|
"letters, digits, and underscores."
|
|
45
45
|
end
|
|
46
46
|
|
|
@@ -53,7 +53,7 @@ module Bolt
|
|
|
53
53
|
[version_requirement, SemanticPuppet::VersionRange.parse(version_requirement || '>= 0')]
|
|
54
54
|
rescue StandardError
|
|
55
55
|
raise Bolt::ValidationError,
|
|
56
|
-
"Invalid version requirement for Forge module specification #{@full_name}: "\
|
|
56
|
+
"Invalid version requirement for Forge module specification #{@full_name}: " \
|
|
57
57
|
"#{version_requirement.inspect}"
|
|
58
58
|
end
|
|
59
59
|
|
|
@@ -39,7 +39,7 @@ module Bolt
|
|
|
39
39
|
|
|
40
40
|
if @name.nil? && @resolve == false
|
|
41
41
|
raise Bolt::ValidationError,
|
|
42
|
-
"Missing name for Git module specification: #{@git}. Git module specifications "\
|
|
42
|
+
"Missing name for Git module specification: #{@git}. Git module specifications " \
|
|
43
43
|
"must include a 'name' key when 'resolve' is false."
|
|
44
44
|
end
|
|
45
45
|
|
|
@@ -61,9 +61,9 @@ module Bolt
|
|
|
61
61
|
|
|
62
62
|
unless (match = name.match(NAME_REGEX))
|
|
63
63
|
raise Bolt::ValidationError,
|
|
64
|
-
"Invalid name for Git module specification: #{name}. Name must match "\
|
|
65
|
-
"'name' or 'owner/name'. Owner segment can only include letters or digits. "\
|
|
66
|
-
"Name segment must start with a lowercase letter and can only include "\
|
|
64
|
+
"Invalid name for Git module specification: #{name}. Name must match " \
|
|
65
|
+
"'name' or 'owner/name'. Owner segment can only include letters or digits. " \
|
|
66
|
+
"Name segment must start with a lowercase letter and can only include " \
|
|
67
67
|
"lowercase letters, digits, and underscores."
|
|
68
68
|
end
|
|
69
69
|
|
|
@@ -123,8 +123,8 @@ module Bolt
|
|
|
123
123
|
|
|
124
124
|
unless module_id
|
|
125
125
|
raise Bolt::Error.new(
|
|
126
|
-
"Unable to locate metadata and calculate SHA for ref #{@ref} at #{@git}. This may "\
|
|
127
|
-
"not be a valid module. For more information about how Bolt attempted to locate "\
|
|
126
|
+
"Unable to locate metadata and calculate SHA for ref #{@ref} at #{@git}. This may " \
|
|
127
|
+
"not be a valid module. For more information about how Bolt attempted to locate " \
|
|
128
128
|
"this information, check the debugging logs.",
|
|
129
129
|
'bolt/missing-module-metadata-error'
|
|
130
130
|
)
|
|
@@ -96,6 +96,7 @@ module Bolt
|
|
|
96
96
|
Bolt::Logger.debug("Executing command '#{bare_clone.join(' ')}'")
|
|
97
97
|
_out, err, status = Open3.capture3(*bare_clone)
|
|
98
98
|
return true if status.success?
|
|
99
|
+
|
|
99
100
|
Bolt::Logger.debug("Unable to clone bare repository at #{loc(git, proxy)}: #{err}")
|
|
100
101
|
|
|
101
102
|
# Fall back to cloning the full repository
|
|
@@ -16,6 +16,7 @@ module Bolt
|
|
|
16
16
|
private_class_method def self.name_and_sha(git, ref, proxy)
|
|
17
17
|
repo = parse_repo(git)
|
|
18
18
|
return nil unless repo
|
|
19
|
+
|
|
19
20
|
[request_name(repo, ref, proxy), request_sha(repo, ref, proxy)]
|
|
20
21
|
end
|
|
21
22
|
|
|
@@ -72,7 +73,7 @@ module Bolt
|
|
|
72
73
|
message = "GitHub API rate limit exceeded, unable to calculate SHA."
|
|
73
74
|
|
|
74
75
|
unless ENV['GITHUB_TOKEN']
|
|
75
|
-
message += " To increase your rate limit, set the GITHUB_TOKEN environment "\
|
|
76
|
+
message += " To increase your rate limit, set the GITHUB_TOKEN environment " \
|
|
76
77
|
"variable with a GitHub personal access token."
|
|
77
78
|
end
|
|
78
79
|
|
|
@@ -16,6 +16,7 @@ module Bolt
|
|
|
16
16
|
private_class_method def self.name_and_sha(git, ref, proxy)
|
|
17
17
|
repo = parse_repo(git)
|
|
18
18
|
return nil unless repo
|
|
19
|
+
|
|
19
20
|
[request_name(repo, ref, proxy), request_sha(repo, ref, proxy)]
|
|
20
21
|
end
|
|
21
22
|
|
|
@@ -74,7 +75,7 @@ module Bolt
|
|
|
74
75
|
message = "GitLab API rate limit exceeded, unable to calculate SHA."
|
|
75
76
|
|
|
76
77
|
unless ENV['GITLAB_TOKEN']
|
|
77
|
-
message += " To increase your rate limit, set the GITLAB_TOKEN environment "\
|
|
78
|
+
message += " To increase your rate limit, set the GITLAB_TOKEN environment " \
|
|
78
79
|
"variable with a GitLab personal access token."
|
|
79
80
|
end
|
|
80
81
|
|
|
@@ -23,7 +23,7 @@ module Bolt
|
|
|
23
23
|
# Exit early if project config already includes a spec with this name.
|
|
24
24
|
if project_specs.include?(name)
|
|
25
25
|
@outputter.print_message(
|
|
26
|
-
"Project configuration file #{project_file} already includes specification "\
|
|
26
|
+
"Project configuration file #{project_file} already includes specification " \
|
|
27
27
|
"with name #{name}. Nothing to do."
|
|
28
28
|
)
|
|
29
29
|
return true
|
|
@@ -92,11 +92,13 @@ module Bolt
|
|
|
92
92
|
# modified.
|
|
93
93
|
old = (old&.modules || []).each_with_object({}) do |mod, acc|
|
|
94
94
|
next unless mod.type == :forge
|
|
95
|
+
|
|
95
96
|
acc[mod.full_name] = mod
|
|
96
97
|
end
|
|
97
98
|
|
|
98
99
|
new = new.modules.each_with_object({}) do |mod, acc|
|
|
99
100
|
next unless mod.type == :forge
|
|
101
|
+
|
|
100
102
|
acc[mod.full_name] = mod
|
|
101
103
|
end
|
|
102
104
|
|
data/lib/bolt/outputter/human.rb
CHANGED
|
@@ -36,6 +36,7 @@ module Bolt
|
|
|
36
36
|
|
|
37
37
|
def start_spin
|
|
38
38
|
return unless @spin && @stream.isatty && !@spinning
|
|
39
|
+
|
|
39
40
|
@spinning = true
|
|
40
41
|
@spin_thread = Thread.new do
|
|
41
42
|
loop do
|
|
@@ -47,6 +48,7 @@ module Bolt
|
|
|
47
48
|
|
|
48
49
|
def stop_spin
|
|
49
50
|
return unless @spin && @stream.isatty && @spinning
|
|
51
|
+
|
|
50
52
|
@spinning = false
|
|
51
53
|
@spin_thread.terminate
|
|
52
54
|
@stream.print("\b")
|
|
@@ -61,6 +63,7 @@ module Bolt
|
|
|
61
63
|
#
|
|
62
64
|
def wrap(string, width = 80)
|
|
63
65
|
return string unless string.is_a?(String)
|
|
66
|
+
|
|
64
67
|
string.gsub(/(.{1,#{width}})(\s+|\Z)/, "\\1\n")
|
|
65
68
|
end
|
|
66
69
|
|
|
@@ -68,6 +71,7 @@ module Bolt
|
|
|
68
71
|
#
|
|
69
72
|
def truncate(string, width = 80)
|
|
70
73
|
return string unless string.is_a?(String) && string.length > width
|
|
74
|
+
|
|
71
75
|
string.lines.first[0...width].gsub(/\s\w+\s*$/, '...')
|
|
72
76
|
end
|
|
73
77
|
|
|
@@ -164,6 +168,7 @@ module Bolt
|
|
|
164
168
|
result.resource_logs.each do |log|
|
|
165
169
|
# Omit low-level info/debug messages
|
|
166
170
|
next if %w[info debug].include?(log['level'])
|
|
171
|
+
|
|
167
172
|
message = format_log(log)
|
|
168
173
|
@stream.puts(indent(2, message))
|
|
169
174
|
end
|
|
@@ -656,7 +661,7 @@ module Bolt
|
|
|
656
661
|
|
|
657
662
|
print_message(<<~OUTPUT)
|
|
658
663
|
Created plan '#{name}' at '#{path}'
|
|
659
|
-
|
|
664
|
+
|
|
660
665
|
Show this plan with:
|
|
661
666
|
#{show_command} #{name}
|
|
662
667
|
Run this plan with:
|
|
@@ -675,7 +680,7 @@ module Bolt
|
|
|
675
680
|
|
|
676
681
|
print_message(<<~OUTPUT)
|
|
677
682
|
Created policy '#{name}' at '#{path}'
|
|
678
|
-
|
|
683
|
+
|
|
679
684
|
Apply this policy with:
|
|
680
685
|
#{apply_command}
|
|
681
686
|
Show available policies with:
|
|
@@ -786,8 +791,8 @@ module Bolt
|
|
|
786
791
|
info = +''
|
|
787
792
|
|
|
788
793
|
# Add target count summary
|
|
789
|
-
count = "#{inventory_count + adhoc_count} total, "\
|
|
790
|
-
"#{inventory_count} from inventory, "\
|
|
794
|
+
count = "#{inventory_count + adhoc_count} total, " \
|
|
795
|
+
"#{inventory_count} from inventory, " \
|
|
791
796
|
"#{adhoc_count} adhoc"
|
|
792
797
|
info << colorize(:cyan, "Target count\n")
|
|
793
798
|
info << indent(2, count)
|
|
@@ -26,8 +26,8 @@ module Bolt
|
|
|
26
26
|
definition_keys = definition.keys.to_set
|
|
27
27
|
unless PARAMETER_KEYS.superset?(definition_keys)
|
|
28
28
|
invalid_keys = definition_keys - PARAMETER_KEYS
|
|
29
|
-
raise Bolt::Error.new("Plan parameter #{param.inspect} contains illegal key(s)" \
|
|
30
|
-
"
|
|
29
|
+
raise Bolt::Error.new("Plan parameter #{param.inspect} contains illegal key(s) " \
|
|
30
|
+
"#{invalid_keys.to_a.inspect}",
|
|
31
31
|
"bolt/invalid-plan")
|
|
32
32
|
end
|
|
33
33
|
end
|
data/lib/bolt/pal.rb
CHANGED
|
@@ -147,6 +147,7 @@ module Bolt
|
|
|
147
147
|
|
|
148
148
|
def detect_project_conflict(project, environment)
|
|
149
149
|
return unless project && project.load_as_module?
|
|
150
|
+
|
|
150
151
|
# The environment modulepath has stripped out non-existent directories,
|
|
151
152
|
# so we don't need to check for them
|
|
152
153
|
modules = environment.modulepath.flat_map do |path|
|
|
@@ -192,7 +193,7 @@ module Bolt
|
|
|
192
193
|
rescue Puppet::PreformattedError => e
|
|
193
194
|
if e.issue_code == :UNKNOWN_VARIABLE &&
|
|
194
195
|
%w[facts trusted server_facts settings].include?(e.arguments[:name])
|
|
195
|
-
message = "Evaluation Error: Variable '#{e.arguments[:name]}' is not available in the current scope "\
|
|
196
|
+
message = "Evaluation Error: Variable '#{e.arguments[:name]}' is not available in the current scope " \
|
|
196
197
|
"unless explicitly defined."
|
|
197
198
|
details = { file: e.file, line: e.line, column: e.pos }
|
|
198
199
|
PALError.new(message, details)
|
|
@@ -210,6 +211,7 @@ module Bolt
|
|
|
210
211
|
if r.is_a?(StandardError) && !r.is_a?(Bolt::PuppetError)
|
|
211
212
|
raise r
|
|
212
213
|
end
|
|
214
|
+
|
|
213
215
|
r
|
|
214
216
|
end
|
|
215
217
|
|
|
@@ -339,6 +341,7 @@ module Bolt
|
|
|
339
341
|
# If any file has been updated since we last cached, update the
|
|
340
342
|
# cache
|
|
341
343
|
next unless file_modified?(f['path'], f['mtime'])
|
|
344
|
+
|
|
342
345
|
data = get_task_info(task_name, with_mtime: true)
|
|
343
346
|
data = Bolt::Util.walk_keys(data, &:to_s)
|
|
344
347
|
# Tell Bolt to write to the cache file once we're done
|
|
@@ -495,9 +498,9 @@ module Bolt
|
|
|
495
498
|
|
|
496
499
|
pp_path = File.join(mod, 'plans', "#{plan_subpath}.pp")
|
|
497
500
|
if File.exist?(pp_path)
|
|
498
|
-
require '
|
|
499
|
-
require '
|
|
500
|
-
|
|
501
|
+
require 'openvox-strings'
|
|
502
|
+
require 'openvox-strings/yard'
|
|
503
|
+
OpenvoxStrings::Yard.setup!
|
|
501
504
|
YARD::Logger.instance.level = if YARD::Logger.const_defined?(:Severity)
|
|
502
505
|
YARD::Logger::Severity::ERROR
|
|
503
506
|
else
|
data/lib/bolt/plan_creator.rb
CHANGED
|
@@ -10,8 +10,8 @@ module Bolt
|
|
|
10
10
|
def self.validate_plan_name(project, plan_name)
|
|
11
11
|
if project.name.nil?
|
|
12
12
|
raise Bolt::Error.new(
|
|
13
|
-
"Project directory '#{project.path}' is not a named project. Unable to create "\
|
|
14
|
-
"a project-level plan. To name a project, set the 'name' key in the 'bolt-project.yaml' "\
|
|
13
|
+
"Project directory '#{project.path}' is not a named project. Unable to create " \
|
|
14
|
+
"a project-level plan. To name a project, set the 'name' key in the 'bolt-project.yaml' " \
|
|
15
15
|
"configuration file.",
|
|
16
16
|
"bolt/unnamed-project-error"
|
|
17
17
|
)
|
|
@@ -36,7 +36,7 @@ module Bolt
|
|
|
36
36
|
prefix, _, basename = segment_plan_name(plan_name)
|
|
37
37
|
|
|
38
38
|
unless prefix == project.name
|
|
39
|
-
message = "Incomplete plan name: A plan name must be prefixed with the name of the "\
|
|
39
|
+
message = "Incomplete plan name: A plan name must be prefixed with the name of the " \
|
|
40
40
|
"project or module. Did you mean '#{project.name}::#{plan_name}'?"
|
|
41
41
|
|
|
42
42
|
raise Bolt::ValidationError, message
|
|
@@ -44,6 +44,7 @@ module Bolt
|
|
|
44
44
|
|
|
45
45
|
%w[pp yaml].each do |ext|
|
|
46
46
|
next unless (path = project.plans_path + "#{basename}.#{ext}").exist?
|
|
47
|
+
|
|
47
48
|
raise Bolt::Error.new(
|
|
48
49
|
"A plan with the name '#{plan_name}' already exists at '#{path}', nothing to do.",
|
|
49
50
|
'bolt/existing-plan-error'
|
|
@@ -146,7 +147,7 @@ module Bolt
|
|
|
146
147
|
<<~YAML
|
|
147
148
|
# This is the structure of a simple plan. To learn more about writing
|
|
148
149
|
# YAML plans, see the documentation: http://pup.pt/bolt-yaml-plans
|
|
149
|
-
|
|
150
|
+
|
|
150
151
|
# The description sets the description of the plan that will appear
|
|
151
152
|
# in 'bolt plan show' output.
|
|
152
153
|
description: A plan created with bolt plan new
|