X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=doctor_tests%2Fcommon%2Futils.py;h=1a84c824093badef17763675960715e9daf3e730;hb=9fd701278bf7d8c5b9451491bcb1a92580adc780;hp=2e823acba12ab96f4b3eade4e993639f889a1b25;hpb=44d1e135eced7afe13b8772a610ae5cdae310b68;p=doctor.git diff --git a/doctor_tests/common/utils.py b/doctor_tests/common/utils.py index 2e823acb..1a84c824 100644 --- a/doctor_tests/common/utils.py +++ b/doctor_tests/common/utils.py @@ -47,13 +47,17 @@ def match_rep_in_file(regex, full_path): return None +def get_doctor_test_root_dir(): + current_dir = os.path.split(os.path.realpath(__file__))[0] + return os.path.dirname(current_dir) + + class SSHClient(object): def __init__(self, ip, username, password=None, pkey=None, key_filename=None, log=None, look_for_keys=False, allow_agent=False): self.client = paramiko.SSHClient() - self.client.load_system_host_keys() - self.client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) + self.client.set_missing_host_key_policy(paramiko.WarningPolicy()) self.client.connect(ip, username=username, password=password, pkey=pkey, key_filename=key_filename, look_for_keys=look_for_keys, @@ -73,7 +77,8 @@ class SSHClient(object): output.append(line.decode('utf-8')) if ret: if self.log: - self.log.info("*** FAILED to run command %s (%s)" % (command, ret)) + self.log.info("*** FAILED to run command %s (%s)" + % (command, ret)) raise Exception( "Unable to run \ncommand: %s\nret: %s" % (command, ret))