-
- command = "source stackrc; nova show %s | awk '/ ctlplane network /{print $5}'" % (hostname_in_undercloud)
- 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))
- return host_ip[0]
-
- def setup_stunnel(self):
- self.log.info('Setup ssh stunnel in controller nodes in Apex installer......')
- for node_ip in self.controllers:
- cmd = "sudo 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()
+ command = "source stackrc; nova show %s | awk '/ ctlplane network /{print $5}'" % (hostname_in_undercloud) # noqa
+ host_ips = self._run_cmd_remote(self.client, command)
+ return host_ips[0]