chef-metal 0.9.1 → 0.9.2
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/CHANGELOG.md +4 -0
- data/lib/chef_metal/transport/ssh.rb +39 -23
- data/lib/chef_metal/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8eb7ec1d176cfeebf9d5c6e50ab3a45d172e605a
|
4
|
+
data.tar.gz: f4fcde957a37359fdc200e8414c372ad2db2f7a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8fb557ac7fbec088c63b81242f59ef81cd5ba91d1d8beeb55f6b6f14789026aaf93a58e34faa3cdbfa40e61b1d9bf50c7394bbaf7efca0a669f07e29f351ba4d
|
7
|
+
data.tar.gz: d2116ceda71535205ef6c21bac69945d65531804ec356432302ac112b73189c21d762d4750033e5c0163b8cc1ce790a6cdc2401afbbffa15ad69f5458f9845ad
|
data/CHANGELOG.md
CHANGED
@@ -25,34 +25,35 @@ module ChefMetal
|
|
25
25
|
stdout = ''
|
26
26
|
stderr = ''
|
27
27
|
exitstatus = nil
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
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
|
-
|
37
|
-
|
38
|
+
channel.exec("#{options[:prefix]}#{command}") do |ch, success|
|
39
|
+
raise "could not execute command: #{command.inspect}" unless success
|
38
40
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
41
|
+
channel.on_data do |ch2, data|
|
42
|
+
stdout << data
|
43
|
+
stream_chunk(execute_options, data, nil)
|
44
|
+
end
|
43
45
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
46
|
+
channel.on_extended_data do |ch2, type, data|
|
47
|
+
stderr << data
|
48
|
+
stream_chunk(execute_options, nil, data)
|
49
|
+
end
|
48
50
|
|
49
|
-
|
50
|
-
|
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
|
-
|
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
|
-
|
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
|
data/lib/chef_metal/version.rb
CHANGED
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.
|
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-
|
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.
|
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.
|
96
|
+
version: '0.3'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: chef-metal-vagrant
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|