Run enable_ssh_admin also for Nova+Ironic deployments

For Nova+Ironic deployments we could run the enable_ssh_admin Mistral
workflow directly and take advantage of the public key injection via
os-collect-config, but since the script seems to work for both
deployed-server and Nova/Ironic envs, we can just use it
unconditionally and keep the logic DRY.

Change-Id: I2bae54d282591abc8a014cdce805e90305a7a34d
Closes-Bug: #1735173
This commit is contained in:
Jiri Stransky 2017-11-29 14:41:18 +01:00 committed by Emilien Macchi
parent 7559118415
commit 13485a64c8
1 changed files with 19 additions and 20 deletions

View File

@ -111,29 +111,28 @@ def config_download(log, clients, stack, templates, deployed_server,
if match:
ips.append(line.split(' ')[0])
if deployed_server:
script_path = os.path.join(templates,
'deployed-server',
'scripts',
'enable-ssh-admin.sh')
script_path = os.path.join(templates,
'deployed-server',
'scripts',
'enable-ssh-admin.sh')
env = os.environ.copy()
env.update(dict(OVERCLOUD_HOSTS=' '.join(ips),
OVERCLOUD_SSH_USER=ssh_user,
OVERCLOUD_SSH_KEY=ssh_key))
env = os.environ.copy()
env.update(dict(OVERCLOUD_HOSTS=' '.join(ips),
OVERCLOUD_SSH_USER=ssh_user,
OVERCLOUD_SSH_KEY=ssh_key))
proc = subprocess.Popen([script_path], env=env, shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
proc = subprocess.Popen([script_path], env=env, shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
while True:
line = proc.stdout.readline().decode('utf-8')
if line:
log.info(line.rstrip())
if line == '' and proc.poll() is not None:
break
if proc.returncode != 0:
raise RuntimeError('%s failed.' % script_path)
while True:
line = proc.stdout.readline().decode('utf-8')
if line:
log.info(line.rstrip())
if line == '' and proc.poll() is not None:
break
if proc.returncode != 0:
raise RuntimeError('%s failed.' % script_path)
workflow_client = clients.workflow_engine
tripleoclients = clients.tripleoclient