kitchen-sync 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: de3176802b5d0d2d9e1f1596f6dea7c3b779a5e8
4
- data.tar.gz: fb8c7e2f628f05a4b02f4412b3a17fc815d6f88c
3
+ metadata.gz: 0376fdf7d97ee105cfbfb248cd7a42ffd0e6132c
4
+ data.tar.gz: 6fa0f7cb5fd4dd9eba236520f17de3591a507f48
5
5
  SHA512:
6
- metadata.gz: 4227cbf1e1a90875146c48ad09a508a550ef19adba081cde50b14449ff9a55b0b22791da4a4c85a5fc94c3f52a6def3874a2d2dc31093a5f75bcaf64774ca032
7
- data.tar.gz: e75859c18388457ae8df42177cfa22a8fdfe6982dcedcca4afaf933133173cbf8a30fd6d87d7e3ca0f6b3330f2d77bc8946a22daa4a9fd7e25e6ea108edabb20
6
+ metadata.gz: 2f587f0f0b9885937e4e5852e98bb308ae6105ea2a0c3b9d9ed76cbf24a37e181a1651c72055c39ff564f7aa6b00893bb36796eb5127a9d4e1fef747e20d0234
7
+ data.tar.gz: e82b6548d9f31de4acb86f4ee12ace4a9b1644078f116e12735291f1b6d99f0033dd8c0de70173b2eda1acd48db14330443a13064ed0b382296d8f4be21d5ef6
@@ -16,5 +16,5 @@
16
16
 
17
17
 
18
18
  class KitchenSync
19
- VERSION = '2.0.0'
19
+ VERSION = '2.1.0'
20
20
  end
@@ -50,11 +50,23 @@ module Kitchen
50
50
  def close
51
51
  if @sftp_session
52
52
  logger.debug("[SFTP] closing connection to #{self}")
53
- sftp_session.close_channel
53
+ begin
54
+ sftp_session.close_channel
55
+ rescue Net::SSH::Disconnect
56
+ # Welp, we tried.
57
+ end
54
58
  end
55
59
  ensure
56
60
  @sftp_session = nil
57
- super
61
+ # Make sure we can turn down the session even if closing the channels
62
+ # fails in the middle because of a remote disconnect.
63
+ saved_session = @session
64
+ begin
65
+ super
66
+ rescue Net::SSH::Disconnect
67
+ # Boooo zlib warnings.
68
+ saved_session.transport.close if saved_session
69
+ end
58
70
  end
59
71
 
60
72
  def upload(locals, remote)
@@ -99,6 +111,7 @@ module Kitchen
99
111
  # Tracked in https://github.com/test-kitchen/test-kitchen/pull/724
100
112
  def execute_with_exit_code(command)
101
113
  exit_code = nil
114
+ closed = false
102
115
  session.open_channel do |channel|
103
116
 
104
117
  channel.request_pty
@@ -116,9 +129,13 @@ module Kitchen
116
129
  channel.on_request("exit-status") do |_ch, data|
117
130
  exit_code = data.read_long
118
131
  end
132
+
133
+ channel.on_close do |ch| # This block is new.
134
+ closed = true
135
+ end
119
136
  end
120
137
  end
121
- session.loop { exit_code.nil? } # THERE IS A CHANGE ON THIS LINE, PAY ATTENTION!!!!!!
138
+ session.loop { exit_code.nil? && !closed } # THERE IS A CHANGE ON THIS LINE, PAY ATTENTION!!!!!!
122
139
  exit_code
123
140
  end
124
141
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-sync
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Noah Kantrowitz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-13 00:00:00.000000000 Z
11
+ date: 2016-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-kitchen