import subprocess
from doctor_tests.installer.base import BaseInstaller
+from doctor_tests.installer.common.vitrage import \
+ set_vitrage_host_down_template
+from doctor_tests.common.constants import Inspector
from doctor_tests.common.utils import load_json_file
from doctor_tests.common.utils import write_json_file
self.restore_apply_patches()
def get_ssh_key_from_installer(self):
- self.log.info('Assuming SSH keys already exchanged with computer for local installer type')
+ self.log.info('Assuming SSH keys already exchanged with computer'
+ 'for local installer type')
return None
def get_host_ip_from_hostname(self, hostname):
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()
+ host_ip = stdout.strip().decode("utf-8")
- self.log.info('Get host_ip:%s from host_name:%s in local installer' % (host_ip, hostname))
+ 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()
+ if self.conf.inspector.type == Inspector.VITRAGE:
+ set_vitrage_host_down_template()
+ os.system('sudo systemctl restart devstack@vitrage-graph.service')
def restore_apply_patches(self):
self._restore_nova_policy()
if self.policy_modified or self.add_policy_file:
write_json_file(self.nova_policy_file, data)
- os.system('screen -S stack -p n-api -X stuff "^C^M^[[A^M"')
+ os.system('sudo systemctl restart devstack@n-api.service')
def _restore_nova_policy(self):
if self.policy_modified:
- shutil.copyfile(self.nova_policy_file_backup, self.nova_policy_file)
+ shutil.copyfile(self.nova_policy_file_backup,
+ self.nova_policy_file)
os.remove(self.nova_policy_file_backup)
elif self.add_policy_file:
os.remove(self.nova_policy_file)
if self.add_policy_file or self.policy_modified:
- os.system('screen -S stack -p n-api -X stuff "^C^M^[[A^M"')
+ os.system('sudo systemctl restart devstack@n-api.service')
self.add_policy_file = False
self.policy_modified = False