diff options
author | Sander Vrijders <sander.vrijders@ugent.be> | 2017-04-13 17:41:17 +0200 |
---|---|---|
committer | Sander Vrijders <sander.vrijders@ugent.be> | 2017-04-13 17:41:17 +0200 |
commit | cb4bfa4e632a70f786d4c27b0c02a47b774b9297 (patch) | |
tree | 3b91938af91d788b82d8bd11626cef88910c063e | |
parent | 81ca2217d34b70e6a3ef7385261be38958cb4a42 (diff) | |
parent | 17f8e41dc79dbc452a7bfa87717a0ca878eb773e (diff) | |
download | rumba-cb4bfa4e632a70f786d4c27b0c02a47b774b9297.tar.gz rumba-cb4bfa4e632a70f786d4c27b0c02a47b774b9297.zip |
Merge branch 'master' into proxycmd
-rw-r--r-- | rumba/ssh_support.py | 17 | ||||
-rw-r--r-- | rumba/testbeds/emulab.py | 2 |
2 files changed, 11 insertions, 8 deletions
diff --git a/rumba/ssh_support.py b/rumba/ssh_support.py index 2c9d6d0..e66db43 100644 --- a/rumba/ssh_support.py +++ b/rumba/ssh_support.py @@ -33,7 +33,7 @@ def _print_stream(stream): o_array = o.split('\\n') for oi in o_array: print(oi) - return o_array + return o def execute_commands(testbed, ssh_config, commands, time_out=3): ''' @@ -59,16 +59,19 @@ def execute_commands(testbed, ssh_config, commands, time_out=3): testbed.username, testbed.password, look_for_keys=True, timeout=time_out, sock=proxy) + o = "" for command in commands: print("%s@%s:%s >> %s" % (testbed.username, - ssh_config.hostname, ssh_config.port, command)) + ssh_config.hostname, + ssh_config.port, + command)) envars = '. /etc/profile;' command = envars + ' ' + command stdin, stdout, stderr = ssh_client.exec_command(command) - o_array = _print_stream(stdout) + o = _print_stream(stdout) _print_stream(stderr) ssh_client.close() - return o_array + return o except Exception as e: print(str(e)) @@ -88,9 +91,9 @@ def execute_command(testbed, ssh_config, command, time_out=3): @return: stdout resulting from the command ''' - o_array = execute_commands(testbed, ssh_config, [command], time_out) - if o_array != None: - return o_array[0] + o = execute_commands(testbed, ssh_config, [command], time_out) + if o != None: + return o def copy_file_to_testbed(testbed, ssh_config, text, file_name): ''' diff --git a/rumba/testbeds/emulab.py b/rumba/testbeds/emulab.py index 5f85ddb..c031327 100644 --- a/rumba/testbeds/emulab.py +++ b/rumba/testbeds/emulab.py @@ -203,7 +203,7 @@ class Testbed(mod.Testbed): ''' for node in experiment.nodes: - node.ssh_config.hostname = self.full_name(experiment.nodes[0].name) + node.ssh_config.hostname = self.full_name(node.name) cmd = 'cat /var/emulab/boot/topomap' topomap = ssh.execute_command(self, experiment.nodes[0].ssh_config, cmd) |