ridley 1.0.0 → 1.0.1
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.
- data/lib/ridley/host_commander.rb +4 -2
- data/lib/ridley/host_connector/ssh.rb +13 -12
- data/lib/ridley/host_connector/winrm.rb +13 -13
- data/lib/ridley/version.rb +1 -1
- metadata +3 -3
@@ -161,7 +161,7 @@ module Ridley
|
|
161
161
|
def execute(method, host, *args)
|
162
162
|
options = args.last.is_a?(Hash) ? args.pop : Hash.new
|
163
163
|
|
164
|
-
|
164
|
+
connector_for(host, options).send(method, host, *args, options)
|
165
165
|
rescue Errors::HostConnectionError => ex
|
166
166
|
abort(ex)
|
167
167
|
end
|
@@ -207,7 +207,9 @@ module Ridley
|
|
207
207
|
#
|
208
208
|
# @return [Boolean]
|
209
209
|
def connector_port_open?(host, port, wait_time = nil)
|
210
|
-
|
210
|
+
defer {
|
211
|
+
timeout(wait_time || PORT_CHECK_TIMEOUT) { Celluloid::IO::TCPSocket.new(host, port).close; true }
|
212
|
+
}
|
211
213
|
rescue Timeout::Error, SocketError, Errno::ECONNREFUSED, Errno::EHOSTUNREACH, Errno::EADDRNOTAVAIL => ex
|
212
214
|
false
|
213
215
|
end
|
@@ -30,26 +30,27 @@ module Ridley
|
|
30
30
|
begin
|
31
31
|
log.info "Running SSH command: '#{command}' on: '#{host}' as: '#{options[:ssh][:user]}'"
|
32
32
|
|
33
|
-
|
34
|
-
ssh.
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
33
|
+
defer {
|
34
|
+
Net::SSH.start(host, options[:ssh][:user], options[:ssh].slice(*Net::SSH::VALID_OPTIONS)) do |ssh|
|
35
|
+
ssh.open_channel do |channel|
|
36
|
+
if options[:sudo]
|
37
|
+
channel.request_pty do |channel, success|
|
38
|
+
unless success
|
39
|
+
raise "Could not aquire pty: A pty is required for running sudo commands."
|
40
|
+
end
|
41
|
+
|
42
|
+
channel_exec(channel, command, host, response)
|
39
43
|
end
|
40
|
-
|
44
|
+
else
|
41
45
|
channel_exec(channel, command, host, response)
|
42
46
|
end
|
43
|
-
else
|
44
|
-
channel_exec(channel, command, host, response)
|
45
47
|
end
|
48
|
+
ssh.loop
|
46
49
|
end
|
47
|
-
|
48
|
-
end
|
50
|
+
}
|
49
51
|
rescue Net::SSH::Exception => ex
|
50
52
|
response.exit_code = -1
|
51
53
|
response.stderr = ex.message
|
52
|
-
return response
|
53
54
|
end
|
54
55
|
|
55
56
|
case response.exit_code
|
@@ -54,23 +54,23 @@ module Ridley
|
|
54
54
|
begin
|
55
55
|
log.info "Running WinRM Command: '#{command}' on: '#{host}' as: '#{user}'"
|
56
56
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
57
|
+
defer {
|
58
|
+
output = connection.send(command_method, command) do |stdout, stderr|
|
59
|
+
if stdout && stdout.present?
|
60
|
+
response.stdout += stdout
|
61
|
+
log.info "[#{host}](WinRM) #{stdout}"
|
62
|
+
end
|
63
|
+
|
64
|
+
if stderr && stderr.present?
|
65
|
+
response.stderr += stderr
|
66
|
+
log.info "[#{host}](WinRM) #{stderr}"
|
67
|
+
end
|
61
68
|
end
|
62
|
-
|
63
|
-
|
64
|
-
response.stderr += stderr
|
65
|
-
log.info "[#{host}](WinRM) #{stderr}"
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
response.exit_code = output[:exitcode]
|
69
|
+
response.exit_code = output[:exitcode]
|
70
|
+
}
|
70
71
|
rescue ::WinRM::WinRMHTTPTransportError => ex
|
71
72
|
response.exit_code = -1
|
72
73
|
response.stderr = ex.message
|
73
|
-
return response
|
74
74
|
end
|
75
75
|
|
76
76
|
case response.exit_code
|
data/lib/ridley/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ridley
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-06-
|
13
|
+
date: 2013-06-07 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: addressable
|
@@ -390,7 +390,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
390
390
|
version: '0'
|
391
391
|
segments:
|
392
392
|
- 0
|
393
|
-
hash:
|
393
|
+
hash: -3032546146925818617
|
394
394
|
requirements: []
|
395
395
|
rubyforge_project:
|
396
396
|
rubygems_version: 1.8.23
|