@click.command()
@click.argument('name_or_id')
+@click.option(
+ '--force', type=bool, is_flag=True, default=False,
+ help='Ignore timeout and continue with next stack.')
@click.option(
'--timeout', type=int, default=900,
help='Stack delete timeout in seconds.')
@click.pass_context
-def delete(ctx, name_or_id, timeout):
+def delete(ctx, name_or_id, force, timeout):
"""Delete stack."""
os_stack.delete(
ctx.obj['os_cloud'],
name_or_id,
- timeout)
+ force=force,
+ timeout=timeout)
@click.command(name='delete-stale')
print('------------------------------------')
-def delete(os_cloud, name_or_id, timeout=900):
+def delete(os_cloud, name_or_id, force, timeout=900):
"""Delete a stack.
Return True if delete was successful.
print('Retrying delete...')
cloud.delete_stack(name_or_id)
- print('Failed to delete stack.')
- return False
+ print('Failed to delete stack {}'.format(name_or_id))
+ if not force:
+ return False
def delete_stale(os_cloud, jenkins_servers):
--- /dev/null
+---
+features:
+ - |
+ Add a ``--force`` option to delete stacks command. This will help with
+ re-factoring the code in global-jjb scripts using in builder-openstack-cron
+ job to remove orphaned stacks/node and continue with the next stack
+ to delete.