bolt 3.23.0 → 3.25.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 +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/local.rb +1 -0
- data/lib/bolt/config/transport/lxd.rb +9 -0
- data/lib/bolt/inventory/group.rb +11 -4
- data/lib/bolt/inventory/inventory.rb +30 -11
- 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 +2 -1
- data/lib/bolt/outputter/json.rb +3 -1
- data/lib/bolt/outputter/rainbow.rb +2 -1
- data/lib/bolt/plugin/puppetdb.rb +1 -1
- 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
- data/lib/bolt_server/file_cache.rb +10 -8
- 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
|
@@ -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
@@ -88,7 +88,7 @@ module Bolt
|
|
88
88
|
|
89
89
|
facts.uniq!
|
90
90
|
# Returns {'mycertname' => [{'path' => ['nested', 'fact'], 'value' => val'}], ... }
|
91
|
-
fact_values = @puppetdb_client.fact_values(targets, facts)
|
91
|
+
fact_values = @puppetdb_client.fact_values(targets, facts, opts['instance'])
|
92
92
|
|
93
93
|
targets.map do |certname|
|
94
94
|
target_data = fact_values[certname]
|
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
@@ -8,6 +8,7 @@ require 'digest'
|
|
8
8
|
require 'fileutils'
|
9
9
|
require 'net/http'
|
10
10
|
require 'logging'
|
11
|
+
require 'timeout'
|
11
12
|
|
12
13
|
require 'bolt/error'
|
13
14
|
|
@@ -38,8 +39,7 @@ module BoltServer
|
|
38
39
|
|
39
40
|
if do_purge
|
40
41
|
@purge = Concurrent::TimerTask.new(execution_interval: purge_interval,
|
41
|
-
|
42
|
-
run_now: true) { expire(purge_ttl) }
|
42
|
+
run_now: true) { expire(purge_ttl, purge_timeout) }
|
43
43
|
@purge.execute
|
44
44
|
end
|
45
45
|
end
|
@@ -171,13 +171,15 @@ module BoltServer
|
|
171
171
|
serial_execute { download_file(file_path, sha, file_data['uri']) }
|
172
172
|
end
|
173
173
|
|
174
|
-
def expire(purge_ttl)
|
174
|
+
def expire(purge_ttl, purge_timeout)
|
175
175
|
expired_time = Time.now - purge_ttl
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
176
|
+
Timeout.timeout(purge_timeout) do
|
177
|
+
@cache_dir_mutex.with_write_lock do
|
178
|
+
Dir.glob(File.join(@cache_dir, '*')).select { |f| File.directory?(f) }.each do |dir|
|
179
|
+
if (mtime = File.mtime(dir)) < expired_time && dir != tmppath
|
180
|
+
@logger.debug("Removing #{dir}, last used at #{mtime}")
|
181
|
+
FileUtils.remove_dir(dir)
|
182
|
+
end
|
181
183
|
end
|
182
184
|
end
|
183
185
|
end
|
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.25.0
|
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-07-27 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
|