aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSander Vrijders <sander.vrijders@ugent.be>2017-04-13 14:21:54 +0200
committerSander Vrijders <sander.vrijders@ugent.be>2017-04-13 14:21:54 +0200
commitbf71393b1c57741d061eee8b1f27f41daebf236f (patch)
tree5c63ab4fac4921672a08ccb4c1e7dda1568775c5
parenta2b315d257e595af10cf55abdcf026c7c0954020 (diff)
downloadrumba-bf71393b1c57741d061eee8b1f27f41daebf236f.tar.gz
rumba-bf71393b1c57741d061eee8b1f27f41daebf236f.zip
rumba: ssh_support: Fix return of stdout
Stdout was not being returned properly after a recent commit. This fixes it.
-rw-r--r--rumba/ssh_support.py8
-rw-r--r--rumba/testbeds/emulab.py2
2 files changed, 7 insertions, 3 deletions
diff --git a/rumba/ssh_support.py b/rumba/ssh_support.py
index c9ae687..c6615c3 100644
--- a/rumba/ssh_support.py
+++ b/rumba/ssh_support.py
@@ -33,6 +33,7 @@ def _print_stream(stream):
o_array = o.split('\\n')
for oi in o_array:
print(oi)
+ return o_array
def execute_commands(testbed, ssh_config, commands, time_out=3):
'''
@@ -58,9 +59,10 @@ def execute_commands(testbed, ssh_config, commands, time_out=3):
envars = '. /etc/profile;'
command = envars + ' ' + command
stdin, stdout, stderr = ssh_client.exec_command(command)
- _print_stream(stdout)
+ o_array = _print_stream(stdout)
_print_stream(stderr)
ssh_client.close()
+ return o_array
except Exception as e:
print(str(e))
@@ -80,7 +82,9 @@ def execute_command(testbed, ssh_config, command, time_out=3):
@return: stdout resulting from the command
'''
- return execute_commands(testbed, ssh_config, [command], time_out)
+ o_array = execute_commands(testbed, ssh_config, [command], time_out)
+ if o_array != None:
+ return o_array[0]
def copy_file_to_testbed(testbed, ssh_config, text, file_name):
'''
diff --git a/rumba/testbeds/emulab.py b/rumba/testbeds/emulab.py
index aee438e..5f85ddb 100644
--- a/rumba/testbeds/emulab.py
+++ b/rumba/testbeds/emulab.py
@@ -125,7 +125,7 @@ class Testbed(mod.Testbed):
ns = self.generate_ns_script(experiment)
dest_file_name = '/users/'+ self.username + \
'/temp_ns_file.%s.ns' % os.getpid()
- ssh.copy_file_to_testbed(self, self.ops_server(), ns, dest_file_name)
+ ssh.copy_file_to_testbed(self, self.ops_ssh_config, ns, dest_file_name)
cmd = '/usr/testbed/bin/sslxmlrpc_client.py startexp ' + \
'batch=false wait=true proj="' + proj_name + \