novawhiz 0.0.2 → 0.0.3
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/novawhiz.rb +2 -17
- metadata +1 -1
data/lib/novawhiz.rb
CHANGED
@@ -43,21 +43,6 @@ class NovaWhiz
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def run_command(creds, cmd)
|
46
|
-
=begin
|
47
|
-
Net::SSH::Simple.sync do
|
48
|
-
r = ssh(
|
49
|
-
creds[:ip],
|
50
|
-
cmd,
|
51
|
-
:user => creds[:user],
|
52
|
-
:key_data => [ creds[:key] ])
|
53
|
-
if !r.success
|
54
|
-
"command failed on #{creds[:ip]} : #{cmd} : #{r.stdout} : #{r.stderr}"
|
55
|
-
end
|
56
|
-
puts r.stdout
|
57
|
-
puts r.stderr
|
58
|
-
end
|
59
|
-
=end
|
60
|
-
|
61
46
|
res = Net::SSH::Simple.sync do
|
62
47
|
ssh(creds[:ip], '/bin/sh', :user => creds[:user], :key_data => [creds[:key]]) do |e,c,d|
|
63
48
|
case e
|
@@ -68,12 +53,12 @@ class NovaWhiz
|
|
68
53
|
# read the input line-wise (it *will* arrive fragmented!)
|
69
54
|
(@buf ||= '') << d
|
70
55
|
while line = @buf.slice!(/(.*)\r?\n/)
|
71
|
-
yield line if block_given?
|
56
|
+
yield line.chomp if block_given?
|
72
57
|
end
|
73
58
|
when :stderr
|
74
59
|
(@buf ||= '') << d
|
75
60
|
while line = @buf.slice!(/(.*)\r?\n/)
|
76
|
-
yield line if block_given?
|
61
|
+
yield line.chomp if block_given?
|
77
62
|
end
|
78
63
|
end
|
79
64
|
end
|