summaryrefslogtreecommitdiffstats
path: root/doctor_tests/installer/apex.py
diff options
context:
space:
mode:
authorRyota Mibu <r-mibu@cq.jp.nec.com>2018-01-09 13:02:33 +0000
committerGerrit Code Review <gerrit@opnfv.org>2018-01-09 13:02:33 +0000
commit9fd701278bf7d8c5b9451491bcb1a92580adc780 (patch)
tree885287d68762c5e755f082c88780b45e056dcc57 /doctor_tests/installer/apex.py
parentd767217e4ed267c585aa94fbbd3001ec0d59de8c (diff)
parent754b94bba6df6e7aafd5f1ffb8432a40cb815649 (diff)
Merge "support pep8 check"
Diffstat (limited to 'doctor_tests/installer/apex.py')
-rw-r--r--doctor_tests/installer/apex.py50
1 files changed, 33 insertions, 17 deletions
diff --git a/doctor_tests/installer/apex.py b/doctor_tests/installer/apex.py
index 16f0376e..aaacb385 100644
--- a/doctor_tests/installer/apex.py
+++ b/doctor_tests/installer/apex.py
@@ -72,9 +72,11 @@ class ApexInstaller(BaseInstaller):
"| sed -e 's/^.*ctlplane=//' |awk '{print $1}'"
ret, controllers = self.client.ssh(command)
if ret:
- raise Exception('Exec command to get controller ips in Apex installer failed'
- 'ret=%s, output=%s' % (ret, controllers))
- self.log.info('Get controller_ips:%s from Apex installer' % controllers)
+ raise Exception('Exec command to get controller ips'
+ 'in Apex installer failed, ret=%s, output=%s'
+ % (ret, controllers))
+ self.log.info('Get controller_ips:%s from Apex installer'
+ % controllers)
self.controllers = controllers
def get_host_ip_from_hostname(self, hostname):
@@ -82,20 +84,31 @@ class ApexInstaller(BaseInstaller):
hostname_in_undercloud = hostname.split('.')[0]
- command = "source stackrc; nova show %s | awk '/ ctlplane network /{print $5}'" % (hostname_in_undercloud)
+ command = "source stackrc; nova show %s | awk '/ ctlplane network /{print $5}'" % (hostname_in_undercloud) # noqa
ret, host_ip = self.client.ssh(command)
if ret:
- raise Exception('Exec command to get host ip from hostname(%s) in Apex installer failed'
- 'ret=%s, output=%s' % (hostname, ret, host_ip))
- self.log.info('Get host_ip:%s from host_name:%s in Apex installer' % (host_ip, hostname))
+ raise Exception('Exec command to get host ip from hostname(%s)'
+ 'in Apex installer failed, ret=%s, output=%s'
+ % (hostname, ret, host_ip))
+ self.log.info('Get host_ip:%s from host_name:%s in Apex installer'
+ % (host_ip, hostname))
return host_ip[0]
def setup_stunnel(self):
- self.log.info('Setup ssh stunnel in controller nodes in Apex installer......')
+ self.log.info('Setup ssh stunnel in controller nodes'
+ ' in Apex installer......')
for node_ip in self.controllers:
- cmd = "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i %s %s@%s -R %s:localhost:%s sleep 600 > ssh_tunnel.%s.log 2>&1 < /dev/null &" \
- % (self.key_file, self.node_user_name, node_ip,
- self.conf.consumer.port, self.conf.consumer.port, node_ip)
+ cmd = ("ssh -o UserKnownHostsFile=/dev/null"
+ "-o StrictHostKeyChecking=no"
+ "-i %s %s@%s -R %s:localhost:%s"
+ "sleep 600 > ssh_tunnel.%s.log"
+ "2>&1 < /dev/null &"
+ % (self.key_file,
+ self.node_user_name,
+ node_ip,
+ self.conf.consumer.port,
+ self.conf.consumer.port,
+ node_ip))
server = subprocess.Popen(cmd, shell=True)
self.servers.append(server)
server.communicate()
@@ -104,7 +117,8 @@ class ApexInstaller(BaseInstaller):
self.log.info('Set apply patches start......')
for node_ip in self.controllers:
- client = SSHClient(node_ip, self.node_user_name, key_filename=self.key_file)
+ client = SSHClient(node_ip, self.node_user_name,
+ key_filename=self.key_file)
self.controller_clients.append(client)
self._ceilometer_apply_patches(client, self.cm_set_script)
@@ -116,13 +130,15 @@ class ApexInstaller(BaseInstaller):
def _ceilometer_apply_patches(self, ssh_client, script_name):
installer_dir = os.path.dirname(os.path.realpath(__file__))
- script_abs_path = '{0}/{1}/{2}'.format(installer_dir, 'common', script_name)
+ script_abs_path = '{0}/{1}/{2}'.format(installer_dir,
+ 'common', script_name)
ssh_client.scp(script_abs_path, script_name)
cmd = 'sudo python %s' % script_name
ret, output = ssh_client.ssh(cmd)
if ret:
- raise Exception('Do the ceilometer command in controller node failed....'
- 'ret=%s, cmd=%s, output=%s' % (ret, cmd, output))
- ssh_client.ssh('sudo systemctl restart openstack-ceilometer-notification.service')
-
+ raise Exception('Do the ceilometer command in controller'
+ ' node failed, ret=%s, cmd=%s, output=%s'
+ % (ret, cmd, output))
+ ssh_client.ssh('sudo systemctl restart '
+ 'openstack-ceilometer-notification.service')