Don't try stack delete with overcloud delete

We don't support installed heat anymore and with 'native'
heat there is no heat service running after deployment
for the api request.

Also, fixes native launcher support as there is no rm_heat()
for it.

Depends-On: https://review.opendev.org/c/openstack/tripleo-ansible/+/860803
Change-Id: I63cc1a239fe24c8ee7ac4e829c0ac25e344b9a50
This commit is contained in:
rabi 2022-10-10 10:05:59 +05:30
parent d9a542ada2
commit 0167db8879
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

@ -2827,7 +2827,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

@ -1187,7 +1187,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(
@ -1308,7 +1308,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
}
)