test-kitchen 3.8.2 → 3.9.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ba3fe607706ce3ef90092722eb9c1e6a687f8eb55e8cd4e9fef82e9b24666517
4
- data.tar.gz: 3be60ac0bbb386924f6013eb757f46c08af31f568cb878e189da0246f9f4f684
3
+ metadata.gz: 7fae4c8857a3ec9bf61d2e6309ce8b9c593ad5704f497aefeb491c9cc9d5f2a6
4
+ data.tar.gz: ae7e88b27e210a1b484823b4bed9004e18e346df4b90176788823c78c754cfe8
5
5
  SHA512:
6
- metadata.gz: 4a6cb06303ca237abbcded23088db2e657de019d0cafb780bc5e78c8b02f493fe52bebec01c51527b1123f48f176fba2c41961594ad13addcf2a830de4e1b51a
7
- data.tar.gz: '0819c669fc524ea36a24d2a14530e202c92da5656d9b1f78080b1e3138cf20d348afa1b38a356f5c053bfe7508beebd58bf3d93eea9434ee45cd62cec3d5920c'
6
+ metadata.gz: bea3627796d12458f2f65a62d0bb5f5d3efd986fdf3bd2800a4adb0b360003ffa4da0f2a0705462388cae152a9faef30cba1d1bef5bc17ceb5ba17e04b653f44
7
+ data.tar.gz: 47d8c9adc151d38b2670b0f191bddb31966c523e87612dddee898584aaa5ad9ca1bc07eb8ec2544363125c78faa8430dd3b45f19e7df82d00143bfb06df72295
@@ -22,6 +22,7 @@ require "fileutils" unless defined?(FileUtils)
22
22
  require "net/ssh" unless defined?(Net::SSH)
23
23
  require "net/ssh/gateway"
24
24
  require "net/ssh/proxy/http"
25
+ require "net/ssh/proxy/command"
25
26
  require "net/scp"
26
27
  require "timeout" unless defined?(Timeout)
27
28
  require "benchmark" unless defined?(Benchmark)
@@ -63,6 +64,8 @@ module Kitchen
63
64
  default_config :ssh_http_proxy_user, nil
64
65
  default_config :ssh_http_proxy_password, nil
65
66
 
67
+ default_config :ssh_proxy_command, nil
68
+
66
69
  default_config :ssh_key, nil
67
70
  expand_path_for :ssh_key
68
71
 
@@ -164,7 +167,9 @@ module Kitchen
164
167
  if options.key?(:forward_agent)
165
168
  args += %W{ -o ForwardAgent=#{options[:forward_agent] ? "yes" : "no"} }
166
169
  end
167
- if ssh_gateway
170
+ if ssh_proxy_command
171
+ args += %W{ -o ProxyCommand=#{ssh_proxy_command} }
172
+ elsif ssh_gateway
168
173
  gateway_command = "ssh -q #{ssh_gateway_username}@#{ssh_gateway} nc #{hostname} #{port}"
169
174
  args += %W{ -o ProxyCommand=#{gateway_command} -p #{ssh_gateway_port} }
170
175
  end
@@ -309,6 +314,11 @@ module Kitchen
309
314
  # @api private
310
315
  attr_reader :ssh_http_proxy_password
311
316
 
317
+ # @return [String] The ProxyCommand to use when connecting to the
318
+ # remote SSH host
319
+ # @api private
320
+ attr_reader :ssh_proxy_command
321
+
312
322
  # Establish an SSH session on the remote host using a gateway host.
313
323
  #
314
324
  # @param opts [Hash] retry options
@@ -341,7 +351,13 @@ module Kitchen
341
351
  # @api private
342
352
  def establish_connection(opts)
343
353
  retry_connection(opts) do
344
- Net::SSH.start(hostname, username, options)
354
+ # Handle proxy command creation at connection time
355
+ connection_options = options.dup
356
+ if connection_options[:ssh_proxy_command_string]
357
+ proxy_command = connection_options.delete(:ssh_proxy_command_string)
358
+ connection_options[:proxy] = Net::SSH::Proxy::Command.new(proxy_command)
359
+ end
360
+ Net::SSH.start(hostname, username, connection_options)
345
361
  end
346
362
  end
347
363
 
@@ -428,6 +444,7 @@ module Kitchen
428
444
  @ssh_http_proxy_user = @options.delete(:ssh_http_proxy_user)
429
445
  @ssh_http_proxy_password = @options.delete(:ssh_http_proxy_password)
430
446
  @ssh_http_proxy_port = @options.delete(:ssh_http_proxy_port)
447
+ @ssh_proxy_command = @options.delete(:ssh_proxy_command)
431
448
  end
432
449
 
433
450
  # Returns a connection session, or establishes one when invoked the
@@ -488,6 +505,7 @@ module Kitchen
488
505
  ssh_gateway: data[:ssh_gateway],
489
506
  ssh_gateway_username: data[:ssh_gateway_username],
490
507
  ssh_gateway_port: data[:ssh_gateway_port],
508
+ ssh_proxy_command: data[:ssh_proxy_command],
491
509
  }
492
510
 
493
511
  if data[:ssh_key] && !data[:password]
@@ -501,6 +519,9 @@ module Kitchen
501
519
  options_http_proxy[:user] = data[:ssh_http_proxy_user]
502
520
  options_http_proxy[:password] = data[:ssh_http_proxy_password]
503
521
  opts[:proxy] = Net::SSH::Proxy::HTTP.new(data[:ssh_http_proxy], data[:ssh_http_proxy_port], options_http_proxy)
522
+ elsif data[:ssh_proxy_command]
523
+ # Store the command string, create proxy object during connection
524
+ opts[:ssh_proxy_command_string] = data[:ssh_proxy_command]
504
525
  end
505
526
 
506
527
  if data[:ssh_key_only]
@@ -16,5 +16,5 @@
16
16
  # limitations under the License.
17
17
 
18
18
  module Kitchen
19
- VERSION = "3.8.2".freeze
19
+ VERSION = "3.9.0".freeze
20
20
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: test-kitchen
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.8.2
4
+ version: 3.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fletcher Nichol