Skip to content

Commit da7b9ec

Browse files
authored
RND-622 Add --recursive to cfy uninstall (#1482)
* RND-622 Add --recursive to `cfy uninstall` * update the mock assertion
1 parent c3034e3 commit da7b9ec

3 files changed

Lines changed: 16 additions & 8 deletions

File tree

cloudify_cli/cli/cfy.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1922,6 +1922,12 @@ def __init__(self):
19221922
required=False,
19231923
help=helptexts.EVALUATE_FUNCTIONS,
19241924
)
1925+
self.recursive_delete = click.option(
1926+
'--recursive',
1927+
default=False,
1928+
is_flag=True,
1929+
help=helptexts.RECURSIVE_DELETE,
1930+
)
19251931

19261932
def common_options(self, f):
19271933
"""A shorthand for applying commonly used arguments.
@@ -1988,16 +1994,11 @@ def agent_filters(self, f):
19881994
is_flag=True,
19891995
help=helptexts.AGENT_ALL_STATES,
19901996
)
1991-
self.recursive_delete = click.option(
1992-
'--recursive',
1993-
default=False,
1994-
is_flag=True,
1995-
help=helptexts.RECURSIVE_DELETE,
1996-
)
19971997

19981998
# we add separate --node-instance-id, --node-id and --deployment-id
19991999
# arguments, but only expose a agents_filter = {'node_id': ..} dict
20002000
# to the decorated function
2001+
20012002
def _filters_deco(f):
20022003
@wraps(f)
20032004
def _inner(*args, **kwargs):

cloudify_cli/commands/uninstall.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
@cfy.argument('deployment-id')
2727
@cfy.options.workflow_id('uninstall')
2828
@cfy.options.force(help=helptexts.FORCE_CONCURRENT_EXECUTION)
29+
@cfy.options.recursive_delete
2930
@cfy.options.parameters
3031
@cfy.options.allow_custom_parameters
3132
@cfy.options.timeout()
@@ -39,6 +40,7 @@ def manager(ctx,
3940
deployment_id,
4041
workflow_id,
4142
force,
43+
recursive,
4244
parameters,
4345
allow_custom_parameters,
4446
timeout,
@@ -57,6 +59,8 @@ def manager(ctx,
5759
# if no workflow was supplied, execute the `uninstall` workflow
5860
workflow_id = workflow_id or DEFAULT_UNINSTALL_WORKFLOW
5961

62+
if recursive:
63+
parameters['recursive'] = True
6064
ctx.invoke(
6165
executions.manager_start,
6266
workflow_id=workflow_id,
@@ -79,7 +83,9 @@ def manager(ctx,
7983
deployments.manager_delete,
8084
deployment_id=deployment_id,
8185
force=force,
82-
tenant_name=tenant_name)
86+
tenant_name=tenant_name,
87+
recursive=recursive,
88+
)
8389
ctx.invoke(
8490
blueprints.delete,
8591
blueprint_id=blueprint_id,

cloudify_cli/tests/commands/test_uninstall.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ def test_deployments_delete_arguments(self, deployments_delete_mock, *_):
9191
deployments_delete_mock.assert_called_with(
9292
deployment_id=u'did',
9393
force=False,
94-
tenant_name=None
94+
tenant_name=None,
95+
recursive=False,
9596
)
9697

9798
@patch('cloudify_cli.env.get_rest_client')

0 commit comments

Comments
 (0)