aboutsummaryrefslogtreecommitdiff
path: root/rumba
diff options
context:
space:
mode:
authorVincenzo Maffione <v.maffione@gmail.com>2017-04-12 16:21:45 +0200
committerVincenzo Maffione <v.maffione@gmail.com>2017-04-12 16:21:45 +0200
commit0c23d2434138a203c48c239b36e3f5fe45276672 (patch)
tree348b4325e55b98a4a97f81bbfdf183135a8e27db /rumba
parent658fdeca73429bc115ac5134d987692157f9f28a (diff)
downloadrumba-0c23d2434138a203c48c239b36e3f5fe45276672.tar.gz
rumba-0c23d2434138a203c48c239b36e3f5fe45276672.zip
ssh_support: simplify execute_command
Diffstat (limited to 'rumba')
-rw-r--r--rumba/ssh_support.py20
1 files changed, 1 insertions, 19 deletions
diff --git a/rumba/ssh_support.py b/rumba/ssh_support.py
index 4fc9b3c..1faa34e 100644
--- a/rumba/ssh_support.py
+++ b/rumba/ssh_support.py
@@ -78,25 +78,7 @@ def execute_command(testbed, ssh_config, command, time_out=3):
@return: stdout resulting from the command
'''
- ssh_client = get_ssh_client()
-
- try:
- ssh_client.connect(ssh_config.hostname, ssh_config.port,
- testbed.username, testbed.password,
- look_for_keys=True, timeout=time_out)
- stdin, stdout, stderr = ssh_client.exec_command(command)
- del stdin
- err = str(stderr.read()).strip('b\'\"\\n')
- if err != "":
- print(err)
- output = str(stdout.read()).strip('b\'\"\\n')
- ssh_client.close()
-
- return output
-
- except Exception as e:
- print(str(e))
- return
+ return execute_commands(testbed, ssh_config, [command], time_out)
def copy_file_to_testbed(testbed, ssh_config, text, file_name):
'''