rename force to force_delete_nonempty (#50290)

pull/50437/head
Yuwei Zhou 6 years ago committed by Yunge Zhu
parent 338dfaea34
commit 14129b09f7

@ -22,11 +22,13 @@ short_description: Manage Azure resource groups.
description:
- Create, update and delete a resource group.
options:
force:
force_delete_nonempty:
description:
- Remove a resource group and all associated resources. Use with state 'absent' to delete a resource
group that contains resources.
type: bool
aliases:
- force
default: 'no'
location:
description:
@ -116,14 +118,14 @@ class AzureRMResourceGroup(AzureRMModuleBase):
name=dict(type='str', required=True),
state=dict(type='str', default='present', choices=['present', 'absent']),
location=dict(type='str'),
force=dict(type='bool', default=False)
force_delete_nonempty=dict(type='bool', default=False, aliases=['force'])
)
self.name = None
self.state = None
self.location = None
self.tags = None
self.force = None
self.force_delete_nonempty = None
self.results = dict(
changed=False,
@ -201,8 +203,9 @@ class AzureRMResourceGroup(AzureRMModuleBase):
)
self.results['state'] = self.create_or_update_resource_group(params)
elif self.state == 'absent':
if contains_resources and not self.force:
self.fail("Error removing resource group {0}. Resources exist within the group.".format(self.name))
if contains_resources and not self.force_delete_nonempty:
self.fail("Error removing resource group {0}. Resources exist within the group. "
"Use `force_delete_nonempty` to force delete.".format(self.name))
self.delete_resource_group()
return self.results

Loading…
Cancel
Save