X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=tests%2Finstaller%2Flocal.py;fp=tests%2Finstaller%2Flocal.py;h=dcdf41e3320ab5396651dc3ffe87fa4e52cb9dd5;hb=19f7ba75850c52e1ae163766b64b6d153e8d7e1b;hp=abe0ba25db9504a33ddbd4f66249c87d150e8540;hpb=836a8932d6c6a502980009b9578f0c6ecf64cb47;p=doctor.git diff --git a/tests/installer/local.py b/tests/installer/local.py index abe0ba25..dcdf41e3 100644 --- a/tests/installer/local.py +++ b/tests/installer/local.py @@ -8,10 +8,11 @@ ############################################################################## import os import shutil +import subprocess from installer.base import BaseInstaller -from utils import load_json_file -from utils import write_json_file +from common.utils import load_json_file +from common.utils import write_json_file class LocalInstaller(BaseInstaller): @@ -34,7 +35,18 @@ class LocalInstaller(BaseInstaller): def get_ssh_key_from_installer(self): self.log.info('Assuming SSH keys already exchanged with computer for local installer type') - return + return None + + def get_host_ip_from_hostname(self, hostname): + self.log.info('Get host ip from host name in local installer......') + + cmd = "getent hosts %s | awk '{ print $1 }'" % (hostname) + server = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True) + stdout, stderr = server.communicate() + host_ip = stdout.strip() + + self.log.info('Get host_ip:%s from host_name:%s in local installer' % (host_ip, hostname)) + return host_ip def set_apply_patches(self): self._set_nova_policy()