Partial Revert "Replace ansible shell with python runner"

This is a partial revert of bcc9c66747.
The change broke using non-fully qualified paths for the overcloud
deploy command. This puts the code back that fixes using a local
environment file during the deployment.

Change-Id: Ia0fc3ef70a1f3938ccccfd778cec24628bbee1fe
Closes-Bug: #1866249
This commit is contained in:
Alex Schultz 2020-03-05 14:17:25 -07:00
parent 3c7a14d668
commit bf2e56b140
2 changed files with 18 additions and 7 deletions

View File

@ -269,7 +269,9 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
mock_create_parameters_env.side_effect = _custom_create_params_env
mock_rm = shutil.rmtree = mock.MagicMock()
self.cmd.take_action(parsed_args)
mock_rm.assert_called_once()
self.assertFalse(orchestration_client.stacks.update.called)
@ -354,7 +356,9 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
'UndercloudHostsEntries':
['192.168.0.1 uc.ctlplane.localhost uc.ctlplane']}}
mock_rm = shutil.rmtree = mock.MagicMock()
self.cmd.take_action(parsed_args)
mock_rm.assert_not_called()
self.assertFalse(orchestration_client.stacks.create.called)
@ -622,7 +626,9 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
mock_create_parameters_env.side_effect = _custom_create_params_env
mock_rm = shutil.rmtree = mock.MagicMock()
self.cmd.take_action(parsed_args)
mock_rm.assert_called_once()
execution_calls = workflow_client.executions.create.call_args_list
deploy_plan_call = execution_calls[1]
deploy_plan_call_input = deploy_plan_call[1]['workflow_input']

View File

@ -25,6 +25,7 @@ import re
import shutil
import six
import subprocess
import tempfile
import time
import yaml
@ -351,16 +352,20 @@ class DeployOvercloud(command.Command):
# copy tht_root to temporary directory because we need to
# download any missing (e.g j2 rendered) files from the plan
tht_root = os.path.abspath(parsed_args.templates)
with utils.TempDirs(dir_prefix='tripleoclient-',
cleanup=(not parsed_args.no_cleanup)) as tht_tmp:
new_tht_root = "%s/tripleo-heat-templates" % tht_tmp
self.log.debug(
"Creating temporary templates tree in %s" % new_tht_root
)
tht_tmp = tempfile.mkdtemp(prefix='tripleoclient-')
new_tht_root = "%s/tripleo-heat-templates" % tht_tmp
self.log.debug("Creating temporary templates tree in %s"
% new_tht_root)
try:
shutil.copytree(tht_root, new_tht_root, symlinks=True)
self._deploy_tripleo_heat_templates(stack, parsed_args,
new_tht_root, tht_root)
finally:
if parsed_args.no_cleanup:
self.log.warning("Not cleaning temporary directory %s"
% tht_tmp)
else:
shutil.rmtree(tht_tmp)
def _deploy_tripleo_heat_templates(self, stack, parsed_args,
tht_root, user_tht_root):