diff options
author | Tomi Juvonen <tomi.juvonen@nokia.com> | 2019-11-28 12:31:51 +0200 |
---|---|---|
committer | Tomi Juvonen <tomi.juvonen@nokia.com> | 2020-01-08 12:22:50 +0200 |
commit | d8eb12f4200c21f569df5bc01d378a846b4c0db0 (patch) | |
tree | acf0a67ef2a9a0e89d63e5863e9dc7bc53190478 /doctor_tests/common/utils.py | |
parent | 7822d631bc2fd2e8faf36d2b809e1e5b69f5251c (diff) |
DevStack support
Support running Doctor testing is DevStack multi-node controller
JIRA: DOCTOR-136
Signed-off-by: Tomi Juvonen <tomi.juvonen@nokia.com>
Change-Id: I1569f3f77d889420b3b8f3c2724c10253e509c28
Diffstat (limited to 'doctor_tests/common/utils.py')
-rw-r--r-- | doctor_tests/common/utils.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/doctor_tests/common/utils.py b/doctor_tests/common/utils.py index 1a8840dd..67ca4f4b 100644 --- a/doctor_tests/common/utils.py +++ b/doctor_tests/common/utils.py @@ -10,6 +10,7 @@ import json import os import paramiko import re +import subprocess def load_json_file(full_path): @@ -97,6 +98,27 @@ class SSHClient(object): ftp.close() +class LocalSSH(object): + + def __init__(self, log): + self.log = log + self.log.info('Init local ssh client') + + def ssh(self, cmd): + ret = 0 + output = "%s failed!!!" % cmd + try: + output = subprocess.check_output((cmd), shell=True, + universal_newlines=True) + except subprocess.CalledProcessError: + ret = 1 + return ret, output + + def scp(self, src_file, dst_file): + return subprocess.check_output("cp %s %s" % (src_file, dst_file), + shell=True) + + def run_async(func): from threading import Thread from functools import wraps |