chef-metal 0.9.1 → 0.9.2

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: d5fdc35ab0b1d5515d7ef8c93e9818b9be68bb62
4
- data.tar.gz: 928fc0d4d3e02ff2c4dd89d00199cb32e3482efa
3
+ metadata.gz: 8eb7ec1d176cfeebf9d5c6e50ab3a45d172e605a
4
+ data.tar.gz: f4fcde957a37359fdc200e8414c372ad2db2f7a0
5
5
  SHA512:
6
- metadata.gz: b9461ee53fcb21a3825868b21c3d343b80b54a665652dfcce8a404c3bc8f539ea269453233faf83d24918563108d581742723ab8a7f7affb7db5a2323e19c591
7
- data.tar.gz: 77247e2fa8c55d9faa8492d0881622da6023dc040c7c01651d94a1f7da677012b5f16931202ca167c664ac132551d1504560652e9dd73ba38c2917283803fdcb
6
+ metadata.gz: 8fb557ac7fbec088c63b81242f59ef81cd5ba91d1d8beeb55f6b6f14789026aaf93a58e34faa3cdbfa40e61b1d9bf50c7394bbaf7efca0a669f07e29f351ba4d
7
+ data.tar.gz: d2116ceda71535205ef6c21bac69945d65531804ec356432302ac112b73189c21d762d4750033e5c0163b8cc1ce790a6cdc2401afbbffa15ad69f5458f9845ad
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Chef Metal Changelog
2
2
 
3
+ ## 0.9.2 (4/13/2014)
4
+
5
+ - Timeout stability fixes (makes EC2 a little stabler for some AMIs)
6
+
3
7
  ## 0.9.1 (4/11/2014)
4
8
 
5
9
  - Make write_file and upload_file create parent directory
@@ -25,34 +25,35 @@ module ChefMetal
25
25
  stdout = ''
26
26
  stderr = ''
27
27
  exitstatus = nil
28
- channel = session.open_channel do |channel|
29
- # Enable PTY unless otherwise specified, some instances require this
30
- unless options[:ssh_pty_enable] == false
31
- channel.request_pty do |chan, success|
32
- raise "could not get pty" if !success && options[:ssh_pty_enable]
28
+ session # grab session outside timeout, it has its own timeout
29
+ with_execute_timeout(execute_options) do
30
+ channel = session.open_channel do |channel|
31
+ # Enable PTY unless otherwise specified, some instances require this
32
+ unless options[:ssh_pty_enable] == false
33
+ channel.request_pty do |chan, success|
34
+ raise "could not get pty" if !success && options[:ssh_pty_enable]
35
+ end
33
36
  end
34
- end
35
37
 
36
- channel.exec("#{options[:prefix]}#{command}") do |ch, success|
37
- raise "could not execute command: #{command.inspect}" unless success
38
+ channel.exec("#{options[:prefix]}#{command}") do |ch, success|
39
+ raise "could not execute command: #{command.inspect}" unless success
38
40
 
39
- channel.on_data do |ch2, data|
40
- stdout << data
41
- stream_chunk(execute_options, data, nil)
42
- end
41
+ channel.on_data do |ch2, data|
42
+ stdout << data
43
+ stream_chunk(execute_options, data, nil)
44
+ end
43
45
 
44
- channel.on_extended_data do |ch2, type, data|
45
- stderr << data
46
- stream_chunk(execute_options, nil, data)
47
- end
46
+ channel.on_extended_data do |ch2, type, data|
47
+ stderr << data
48
+ stream_chunk(execute_options, nil, data)
49
+ end
48
50
 
49
- channel.on_request "exit-status" do |ch, data|
50
- exitstatus = data.read_long
51
+ channel.on_request "exit-status" do |ch, data|
52
+ exitstatus = data.read_long
53
+ end
51
54
  end
52
55
  end
53
- end
54
56
 
55
- with_execute_timeout(execute_options) do
56
57
  channel.wait
57
58
  end
58
59
 
@@ -127,9 +128,10 @@ module ChefMetal
127
128
  end
128
129
 
129
130
  def available?
130
- execute('pwd')
131
+ # If you can't pwd within 10 seconds, you can't pwd
132
+ execute('pwd', :timeout => 10)
131
133
  true
132
- rescue Errno::ETIMEDOUT, Errno::ECONNREFUSED, Errno::ECONNRESET, Net::SSH::AuthenticationFailed, Net::SSH::Disconnect, Net::SSH::HostKeyMismatch
134
+ rescue Timeout::Error, Errno::ETIMEDOUT, Errno::ECONNREFUSED, Errno::ECONNRESET, Net::SSH::AuthenticationFailed, Net::SSH::Disconnect, Net::SSH::HostKeyMismatch
133
135
  Chef::Log.debug("#{username}@#{host} unavailable: could not execute 'pwd' on #{host}: #{$!.inspect}")
134
136
  false
135
137
  end
@@ -139,7 +141,12 @@ module ChefMetal
139
141
  def session
140
142
  @session ||= begin
141
143
  Chef::Log.debug("Opening SSH connection to #{username}@#{host} with options #{ssh_options.inspect}")
142
- Net::SSH.start(host, username, ssh_options)
144
+ # Small initial connection timeout (10s) to help us fail faster when server is just dead
145
+ begin
146
+ Net::SSH.start(host, username, { :timeout => 10 }.merge(ssh_options))
147
+ rescue Timeout::Error
148
+ raise InitialConnectTimeout.new($!)
149
+ end
143
150
  end
144
151
  end
145
152
 
@@ -183,6 +190,15 @@ module ChefMetal
183
190
  end
184
191
  end
185
192
  end
193
+
194
+ class InitialConnectTimeout < Timeout::Error
195
+ def initialize(original_error)
196
+ super(original_error.message)
197
+ @original_error = original_error
198
+ end
199
+
200
+ attr_reader :original_error
201
+ end
186
202
  end
187
203
  end
188
204
  end
@@ -1,3 +1,3 @@
1
1
  module ChefMetal
2
- VERSION = '0.9.1'
2
+ VERSION = '0.9.2'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-metal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Keiser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-12 00:00:00.000000000 Z
11
+ date: 2014-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - ~>
88
88
  - !ruby/object:Gem::Version
89
- version: '0.2'
89
+ version: '0.3'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - ~>
95
95
  - !ruby/object:Gem::Version
96
- version: '0.2'
96
+ version: '0.3'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: chef-metal-vagrant
99
99
  requirement: !ruby/object:Gem::Requirement