serverspec 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/serverspec/helper.rb +7 -6
- data/lib/serverspec/version.rb +1 -1
- metadata +1 -1
data/lib/serverspec/helper.rb
CHANGED
@@ -7,9 +7,9 @@ module Serverspec
|
|
7
7
|
options = Net::SSH::Config.for(host)
|
8
8
|
user = options[:user] || Etc.getlogin
|
9
9
|
|
10
|
-
ret =
|
10
|
+
ret = nil
|
11
11
|
Net::SSH.start(host, user, options) do |ssh|
|
12
|
-
ret = ssh_exec!(ssh, cmd)
|
12
|
+
ret = ssh_exec!(ssh, "sudo #{cmd}")
|
13
13
|
end
|
14
14
|
ret
|
15
15
|
end
|
@@ -21,10 +21,11 @@ module Serverspec
|
|
21
21
|
exit_code = nil
|
22
22
|
exit_signal = nil
|
23
23
|
ssh.open_channel do |channel|
|
24
|
-
channel.
|
25
|
-
|
26
|
-
|
27
|
-
|
24
|
+
channel.request_pty do |ch, success|
|
25
|
+
abort "Could not obtain pty " if !success
|
26
|
+
end
|
27
|
+
channel.exec("#{command}") do |ch, success|
|
28
|
+
abort "FAILED: couldn't execute command (ssh.channel.exec)" if !success
|
28
29
|
channel.on_data do |ch,data|
|
29
30
|
stdout_data += data
|
30
31
|
end
|
data/lib/serverspec/version.rb
CHANGED