Add `--heat-type` in overcloud delete
With this patch adding a new argument `--heat-type` in "overcloud delete" command that will default to `pod` (ephermal heat) and based on input we will set a var `heat_stack_delete` which will be passed to cli-overcloud-delete.yaml to decide whether to run heat stack delete at all. Depends-On: https://review.opendev.org/c/openstack/tripleo-ansible/+/808537 Closes-bug: #1938618 Change-Id: I74cdac5b96a10ec8baefdf3080fd34e03d8f1933
This commit is contained in:
parent
7ddf401b42
commit
1d2c6981aa
|
@ -34,9 +34,10 @@ class TestDeleteOvercloud(deploy_fakes.TestDeployOvercloud):
|
|||
@mock.patch('os.chdir', autospec=True)
|
||||
@mock.patch('tempfile.mkdtemp', autospec=True)
|
||||
def test_overcloud_delete(self, mock_mkdir, mock_cd, mock_run_playbook):
|
||||
arglist = ["overcast", "-y"]
|
||||
arglist = ["overcast", "--heat-type", "installed", "-y"]
|
||||
verifylist = [
|
||||
("stack", "overcast"),
|
||||
("heat_type", "installed"),
|
||||
("yes", True)
|
||||
]
|
||||
|
||||
|
@ -51,6 +52,7 @@ class TestDeleteOvercloud(deploy_fakes.TestDeployOvercloud):
|
|||
constants.ANSIBLE_TRIPLEO_PLAYBOOKS,
|
||||
extra_vars={
|
||||
"stack_name": "overcast",
|
||||
"heat_stack_delete": True
|
||||
},
|
||||
verbosity=3,
|
||||
)
|
||||
|
@ -155,6 +157,7 @@ class TestDeleteOvercloud(deploy_fakes.TestDeployOvercloud):
|
|||
constants.ANSIBLE_TRIPLEO_PLAYBOOKS,
|
||||
extra_vars={
|
||||
"stack_name": "overcast",
|
||||
"heat_stack_delete": False
|
||||
},
|
||||
verbosity=3,
|
||||
)
|
||||
|
|
|
@ -66,6 +66,18 @@ class DeleteOvercloud(command.Command):
|
|||
help=_('Enable unprovisioning of network ports'),
|
||||
default=False,
|
||||
action="store_true")
|
||||
parser.add_argument(
|
||||
'--heat-type',
|
||||
action='store',
|
||||
default='pod',
|
||||
choices=['installed', 'pod', 'container', 'native'],
|
||||
help=_('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'
|
||||
'native: Use an ephemeral Heat process.')
|
||||
)
|
||||
return parser
|
||||
|
||||
def _validate_args(self, parsed_args):
|
||||
|
@ -98,6 +110,8 @@ 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,
|
||||
|
@ -106,7 +120,8 @@ class DeleteOvercloud(command.Command):
|
|||
playbook_dir=constants.ANSIBLE_TRIPLEO_PLAYBOOKS,
|
||||
verbosity=utils.playbook_verbosity(self=self),
|
||||
extra_vars={
|
||||
"stack_name": parsed_args.stack
|
||||
"stack_name": parsed_args.stack,
|
||||
"heat_stack_delete": heat_stack_delete
|
||||
}
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue