diff options
author | dongwenjuan <dong.wenjuan@zte.com.cn> | 2017-08-14 16:58:13 +0800 |
---|---|---|
committer | dongwenjuan <dong.wenjuan@zte.com.cn> | 2017-09-04 22:30:39 +0800 |
commit | 19f7ba75850c52e1ae163766b64b6d153e8d7e1b (patch) | |
tree | f76b13d9d9092209788624609f65872ca8d0dea5 /tests/installer/local.py | |
parent | 836a8932d6c6a502980009b9578f0c6ecf64cb47 (diff) |
refactor failure inject
JIRA: DOCTOR-116
Change-Id: I14deda4ccb47414cff139a522a9196b68e92500e
Signed-off-by: dongwenjuan <dong.wenjuan@zte.com.cn>
Diffstat (limited to 'tests/installer/local.py')
-rw-r--r-- | tests/installer/local.py | 18 |
1 files changed, 15 insertions, 3 deletions
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() |