Merge "Don't try stack delete with overcloud delete"

This commit is contained in:
Zuul 2022-10-19 10:57:09 +00:00 committed by Gerrit Code Review
commit 12e788906c
6 changed files with 13 additions and 14 deletions

View File

@ -330,6 +330,9 @@ heat.filter_factory = heat.api.openstack:faultwrap_filter
tf = tarfile.open(tar_path, 'r:bz2')
tf.extractall(extract_dir)
def rm_heat(self, backup_db=True):
pass
class HeatContainerLauncher(HeatBaseLauncher):
@ -422,7 +425,7 @@ class HeatContainerLauncher(HeatBaseLauncher):
# We don't want to hear from this command..
subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
def rm_heat(self, pid):
def rm_heat(self, backup_db=True):
cmd = ['podman', 'rm', 'heat_all']
log.debug(' '.join(cmd))
# We don't want to hear from this command..

View File

@ -564,13 +564,13 @@ class TestHeatPodLauncherUtils(base.TestCase):
def test_rm_heat(self):
launcher = mock.Mock()
utils.rm_heat(launcher)
launcher.rm_heat.assert_called_once_with(False)
launcher.reset_mock()
utils.rm_heat(launcher, True)
launcher.rm_heat.assert_called_once_with(True)
launcher.reset_mock()
utils.rm_heat(launcher, False)
launcher.rm_heat.assert_called_once_with(False)
launcher.reset_mock()
utils.rm_heat(launcher)
launcher.rm_heat.assert_called_once_with(True)
def test_kill_heat(self):
launcher = mock.Mock()

View File

@ -53,7 +53,6 @@ class TestDeleteOvercloud(deploy_fakes.TestDeployOvercloud):
constants.ANSIBLE_TRIPLEO_PLAYBOOKS,
extra_vars={
"stack_name": "overcast",
"heat_stack_delete": True
},
verbosity=3,
)
@ -158,7 +157,6 @@ class TestDeleteOvercloud(deploy_fakes.TestDeployOvercloud):
constants.ANSIBLE_TRIPLEO_PLAYBOOKS,
extra_vars={
"stack_name": "overcast",
"heat_stack_delete": False
},
verbosity=3,
)

View File

@ -2795,7 +2795,7 @@ def kill_heat(launcher):
launcher.kill_heat(_heat_pid)
def rm_heat(launcher, backup_db=False):
def rm_heat(launcher, backup_db=True):
launcher.rm_heat(backup_db)

View File

@ -1183,7 +1183,7 @@ class DeployOvercloud(command.Command):
if self.heat_launcher:
self.log.info("Stopping ephemeral heat.")
utils.kill_heat(self.heat_launcher)
utils.rm_heat(self.heat_launcher, backup_db=True)
utils.rm_heat(self.heat_launcher)
try:
if do_setup:
deployment.get_hosts_and_enable_ssh_admin(
@ -1304,7 +1304,7 @@ class DeployOvercloud(command.Command):
try:
self.log.info("Stopping ephemeral heat.")
utils.kill_heat(self.heat_launcher)
utils.rm_heat(self.heat_launcher, backup_db=True)
utils.rm_heat(self.heat_launcher)
except Exception as e:
self.log.error('Exception stopping ephemeral Heat')
self.log.error(e)

View File

@ -73,8 +73,9 @@ class DeleteOvercloud(command.Command):
action='store',
default='pod',
choices=['installed', 'pod', 'container', 'native'],
help=_('The type of Heat process that was used to execute'
'the deployment.\n'
help=_('DEPRECATED: This option is ineffective and '
'ignored after deprecation. The type of Heat '
'process that was used to execute the deployment.\n'
'pod (Default): Use an ephemeral Heat pod.\n'
'installed: Use the system installed Heat.\n'
'container: Use an ephemeral Heat container.\n'
@ -112,8 +113,6 @@ class DeleteOvercloud(command.Command):
# start removing infrastructure.
playbooks = ["cli-cleanup-ipa.yml", "cli-overcloud-delete.yaml"]
heat_stack_delete = parsed_args.heat_type in ["installed", "native"]
with utils.TempDirs() as tmp:
utils.run_ansible_playbook(
playbooks,
@ -123,7 +122,6 @@ class DeleteOvercloud(command.Command):
verbosity=utils.playbook_verbosity(self=self),
extra_vars={
"stack_name": parsed_args.stack,
"heat_stack_delete": heat_stack_delete
}
)