Merge "Partial Revert "Replace ansible shell with python runner""

This commit is contained in:
Zuul 2020-03-06 04:17:20 +00:00 committed by Gerrit Code Review
commit 8f356c89db
2 changed files with 18 additions and 7 deletions
tripleoclient

@ -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']

@ -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):