bolt 3.23.1 → 3.26.1
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 +9 -6
- data/bolt-modules/boltlib/lib/puppet/datatypes/applyresult.rb +14 -4
- data/lib/bolt/application.rb +17 -10
- data/lib/bolt/applicator.rb +2 -3
- data/lib/bolt/apply_result.rb +24 -8
- data/lib/bolt/config/transport/lxd.rb +9 -0
- data/lib/bolt/inventory/group.rb +11 -4
- data/lib/bolt/inventory/inventory.rb +43 -15
- data/lib/bolt/inventory/target.rb +9 -0
- data/lib/bolt/module_installer/resolver.rb +1 -1
- data/lib/bolt/module_installer/specs/git_spec.rb +54 -102
- data/lib/bolt/module_installer/specs/id/base.rb +116 -0
- data/lib/bolt/module_installer/specs/id/gitclone.rb +120 -0
- data/lib/bolt/module_installer/specs/id/github.rb +90 -0
- data/lib/bolt/module_installer/specs/id/gitlab.rb +92 -0
- data/lib/bolt/module_installer/specs.rb +5 -3
- data/lib/bolt/module_installer.rb +2 -2
- data/lib/bolt/outputter/human.rb +4 -3
- data/lib/bolt/outputter/json.rb +3 -1
- data/lib/bolt/outputter/rainbow.rb +2 -1
- data/lib/bolt/plugin/puppetdb.rb +3 -2
- data/lib/bolt/puppetdb/client.rb +3 -3
- data/lib/bolt/result.rb +3 -1
- data/lib/bolt/transport/orch/connection.rb +2 -1
- data/lib/bolt/transport/winrm/connection.rb +18 -11
- data/lib/bolt/version.rb +1 -1
- metadata +22 -6
data/lib/bolt/outputter/human.rb
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require_relative '../../bolt/container_result'
|
|
4
4
|
require_relative '../../bolt/pal'
|
|
5
|
+
require_relative '../../bolt/util/format'
|
|
5
6
|
|
|
6
7
|
module Bolt
|
|
7
8
|
class Outputter
|
|
@@ -193,7 +194,7 @@ module Bolt
|
|
|
193
194
|
end
|
|
194
195
|
end
|
|
195
196
|
when 'lookup'
|
|
196
|
-
@stream.puts(indent(2, result['value']))
|
|
197
|
+
@stream.puts(indent(2, Bolt::Util::Format.stringify(result['value'])))
|
|
197
198
|
else
|
|
198
199
|
if result.generic_value.any?
|
|
199
200
|
@stream.puts(indent(2, ::JSON.pretty_generate(result.generic_value)))
|
|
@@ -362,7 +363,7 @@ module Bolt
|
|
|
362
363
|
end
|
|
363
364
|
usage << (Bolt::Util.powershell? ? ' [-Noop]' : ' [--noop]') if task.supports_noop
|
|
364
365
|
params.each do |name, data|
|
|
365
|
-
usage << if data['type']&.start_with?('Optional')
|
|
366
|
+
usage << if data['type']&.start_with?('Optional') || data.key?('default')
|
|
366
367
|
" [#{name}=<value>]"
|
|
367
368
|
else
|
|
368
369
|
" #{name}=<value>"
|
|
@@ -890,7 +891,7 @@ module Bolt
|
|
|
890
891
|
end
|
|
891
892
|
|
|
892
893
|
def print_message(message)
|
|
893
|
-
@stream.puts(message)
|
|
894
|
+
@stream.puts(Bolt::Util::Format.stringify(message))
|
|
894
895
|
end
|
|
895
896
|
|
|
896
897
|
def print_error(message)
|
data/lib/bolt/outputter/json.rb
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require_relative '../../bolt/util/format'
|
|
4
|
+
|
|
3
5
|
module Bolt
|
|
4
6
|
class Outputter
|
|
5
7
|
class JSON < Bolt::Outputter
|
|
@@ -190,7 +192,7 @@ module Bolt
|
|
|
190
192
|
end
|
|
191
193
|
|
|
192
194
|
def print_message(message)
|
|
193
|
-
$stderr.puts(message)
|
|
195
|
+
$stderr.puts(Bolt::Util::Format.stringify(message))
|
|
194
196
|
end
|
|
195
197
|
alias print_error print_message
|
|
196
198
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require_relative '../../bolt/pal'
|
|
4
|
+
require_relative '../../bolt/util/format'
|
|
4
5
|
|
|
5
6
|
module Bolt
|
|
6
7
|
class Outputter
|
|
@@ -110,7 +111,7 @@ module Bolt
|
|
|
110
111
|
end
|
|
111
112
|
|
|
112
113
|
def print_message(message)
|
|
113
|
-
@stream.puts colorize(:rainbow, message)
|
|
114
|
+
@stream.puts colorize(:rainbow, Bolt::Util::Format.stringify(message))
|
|
114
115
|
end
|
|
115
116
|
end
|
|
116
117
|
end
|
data/lib/bolt/plugin/puppetdb.rb
CHANGED
|
@@ -79,8 +79,9 @@ module Bolt
|
|
|
79
79
|
|
|
80
80
|
Bolt::Util.walk_vals(template) do |value|
|
|
81
81
|
# This is done in parts instead of in place so that we only need to
|
|
82
|
-
# make one puppetDB query
|
|
83
|
-
|
|
82
|
+
# make one puppetDB query. Don't gather certname since we already
|
|
83
|
+
# have that and it's not a fact.
|
|
84
|
+
if value.is_a?(String) && value != 'certname'
|
|
84
85
|
facts << fact_path(value)
|
|
85
86
|
end
|
|
86
87
|
value
|
data/lib/bolt/puppetdb/client.rb
CHANGED
|
@@ -110,11 +110,11 @@ module Bolt
|
|
|
110
110
|
return {} if certnames.empty? || facts.empty?
|
|
111
111
|
|
|
112
112
|
certnames.uniq!
|
|
113
|
-
name_query = certnames.map { |
|
|
114
|
-
name_query.
|
|
113
|
+
name_query = certnames.each_slice(100).map { |slice| ["in", "certname", ["array", slice]] }
|
|
114
|
+
name_query.unshift("or")
|
|
115
115
|
|
|
116
116
|
facts_query = facts.map { |f| ["=", "path", f] }
|
|
117
|
-
facts_query.
|
|
117
|
+
facts_query.unshift("or")
|
|
118
118
|
|
|
119
119
|
query = ['and', name_query, facts_query]
|
|
120
120
|
|
data/lib/bolt/result.rb
CHANGED
|
@@ -200,16 +200,18 @@ module Bolt
|
|
|
200
200
|
|
|
201
201
|
def to_data
|
|
202
202
|
serialized_value = safe_value
|
|
203
|
+
|
|
203
204
|
if serialized_value.key?('_sensitive') &&
|
|
204
205
|
serialized_value['_sensitive'].is_a?(Puppet::Pops::Types::PSensitiveType::Sensitive)
|
|
205
206
|
serialized_value['_sensitive'] = serialized_value['_sensitive'].to_s
|
|
206
207
|
end
|
|
208
|
+
|
|
207
209
|
{
|
|
208
210
|
"target" => @target.name,
|
|
209
211
|
"action" => action,
|
|
210
212
|
"object" => object,
|
|
211
213
|
"status" => status,
|
|
212
|
-
"value"
|
|
214
|
+
"value" => serialized_value
|
|
213
215
|
}
|
|
214
216
|
end
|
|
215
217
|
|
|
@@ -6,7 +6,7 @@ module Bolt
|
|
|
6
6
|
class Connection
|
|
7
7
|
attr_reader :logger, :key
|
|
8
8
|
|
|
9
|
-
CONTEXT_KEYS = Set.new(%i[plan_name description params]).freeze
|
|
9
|
+
CONTEXT_KEYS = Set.new(%i[plan_name description params sensitive]).freeze
|
|
10
10
|
|
|
11
11
|
def self.get_key(opts)
|
|
12
12
|
[
|
|
@@ -46,6 +46,7 @@ module Bolt
|
|
|
46
46
|
if plan_context
|
|
47
47
|
begin
|
|
48
48
|
opts = plan_context.select { |k, _| CONTEXT_KEYS.include? k }
|
|
49
|
+
opts[:params] = opts[:params].reject { |k, _| plan_context[:sensitive].include?(k) }
|
|
49
50
|
@client.command.plan_start(opts)['name']
|
|
50
51
|
rescue OrchestratorClient::ApiError => e
|
|
51
52
|
if e.code == '404'
|
|
@@ -53,9 +53,11 @@ module Bolt
|
|
|
53
53
|
@connection = ::WinRM::Connection.new(options)
|
|
54
54
|
@connection.logger = @transport_logger
|
|
55
55
|
|
|
56
|
-
@
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
@connection.shell(:powershell) do |session|
|
|
57
|
+
session.run('$PSVersionTable.PSVersion')
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
@logger.trace { "Opened connection" }
|
|
59
61
|
end
|
|
60
62
|
rescue Timeout::Error
|
|
61
63
|
# If we're using the default port with SSL, a timeout probably means the
|
|
@@ -95,9 +97,8 @@ module Bolt
|
|
|
95
97
|
end
|
|
96
98
|
|
|
97
99
|
def disconnect
|
|
98
|
-
@session&.close
|
|
99
100
|
@client&.disconnect!
|
|
100
|
-
@logger.trace { "Closed
|
|
101
|
+
@logger.trace { "Closed connection" }
|
|
101
102
|
end
|
|
102
103
|
|
|
103
104
|
def execute(command)
|
|
@@ -116,12 +117,18 @@ module Bolt
|
|
|
116
117
|
# propagate to the main thread via the shell, there's no chance
|
|
117
118
|
# they will be unhandled, so the default stack trace is unneeded.
|
|
118
119
|
Thread.current.report_on_exception = false
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
120
|
+
|
|
121
|
+
# Open a new shell instance for each command executed. PowerShell is
|
|
122
|
+
# unable to unload any DLLs loaded when running a PowerShell script
|
|
123
|
+
# or task from the same shell instance they were loaded in, which
|
|
124
|
+
# prevents Bolt from cleaning up the temp directory successfully.
|
|
125
|
+
# Using a new PowerShell instance avoids this limitation.
|
|
126
|
+
@connection.shell(:powershell) do |session|
|
|
127
|
+
result = session.run(command)
|
|
128
|
+
out_wr << result.stdout
|
|
129
|
+
err_wr << result.stderr
|
|
130
|
+
result.exitcode
|
|
131
|
+
end
|
|
125
132
|
ensure
|
|
126
133
|
# Close the streams to avoid the caller deadlocking
|
|
127
134
|
out_wr.close
|
data/lib/bolt/version.rb
CHANGED
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: 3.
|
|
4
|
+
version: 3.26.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Puppet
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2022-
|
|
11
|
+
date: 2022-08-16 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: addressable
|
|
@@ -163,6 +163,9 @@ dependencies:
|
|
|
163
163
|
- - ">="
|
|
164
164
|
- !ruby/object:Gem::Version
|
|
165
165
|
version: '4.0'
|
|
166
|
+
- - "<"
|
|
167
|
+
- !ruby/object:Gem::Version
|
|
168
|
+
version: '7.0'
|
|
166
169
|
type: :runtime
|
|
167
170
|
prerelease: false
|
|
168
171
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -170,6 +173,9 @@ dependencies:
|
|
|
170
173
|
- - ">="
|
|
171
174
|
- !ruby/object:Gem::Version
|
|
172
175
|
version: '4.0'
|
|
176
|
+
- - "<"
|
|
177
|
+
- !ruby/object:Gem::Version
|
|
178
|
+
version: '7.0'
|
|
173
179
|
- !ruby/object:Gem::Dependency
|
|
174
180
|
name: net-ssh-krb
|
|
175
181
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -216,16 +222,22 @@ dependencies:
|
|
|
216
222
|
name: puppetfile-resolver
|
|
217
223
|
requirement: !ruby/object:Gem::Requirement
|
|
218
224
|
requirements:
|
|
219
|
-
- - "
|
|
225
|
+
- - ">="
|
|
220
226
|
- !ruby/object:Gem::Version
|
|
221
|
-
version:
|
|
227
|
+
version: 0.6.2
|
|
228
|
+
- - "<"
|
|
229
|
+
- !ruby/object:Gem::Version
|
|
230
|
+
version: '1.0'
|
|
222
231
|
type: :runtime
|
|
223
232
|
prerelease: false
|
|
224
233
|
version_requirements: !ruby/object:Gem::Requirement
|
|
225
234
|
requirements:
|
|
226
|
-
- - "
|
|
235
|
+
- - ">="
|
|
227
236
|
- !ruby/object:Gem::Version
|
|
228
|
-
version:
|
|
237
|
+
version: 0.6.2
|
|
238
|
+
- - "<"
|
|
239
|
+
- !ruby/object:Gem::Version
|
|
240
|
+
version: '1.0'
|
|
229
241
|
- !ruby/object:Gem::Dependency
|
|
230
242
|
name: puppet-resource_api
|
|
231
243
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -520,6 +532,10 @@ files:
|
|
|
520
532
|
- lib/bolt/module_installer/specs.rb
|
|
521
533
|
- lib/bolt/module_installer/specs/forge_spec.rb
|
|
522
534
|
- lib/bolt/module_installer/specs/git_spec.rb
|
|
535
|
+
- lib/bolt/module_installer/specs/id/base.rb
|
|
536
|
+
- lib/bolt/module_installer/specs/id/gitclone.rb
|
|
537
|
+
- lib/bolt/module_installer/specs/id/github.rb
|
|
538
|
+
- lib/bolt/module_installer/specs/id/gitlab.rb
|
|
523
539
|
- lib/bolt/node/errors.rb
|
|
524
540
|
- lib/bolt/node/output.rb
|
|
525
541
|
- lib/bolt/outputter.rb
|