mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
S3 object parameter and bucket deletion exclusive (#21830)
Fixes ansible#21796 Prevent users from deleting buckets rather than objects by making object parameter and mode=delobj mutually exclusive in task. https://github.com/ansible/ansible/issues/21796
This commit is contained in:
parent
2c0ad28056
commit
c6849a3464
1 changed files with 4 additions and 0 deletions
|
@ -511,6 +511,10 @@ def main():
|
||||||
if module.params.get('object'):
|
if module.params.get('object'):
|
||||||
obj = module.params['object']
|
obj = module.params['object']
|
||||||
|
|
||||||
|
# Bucket deletion does not require obj. Prevents ambiguity with delobj.
|
||||||
|
if obj and mode == "delete":
|
||||||
|
module.fail_json(msg='Parameter obj cannot be used with mode=delete')
|
||||||
|
|
||||||
# allow eucarc environment variables to be used if ansible vars aren't set
|
# allow eucarc environment variables to be used if ansible vars aren't set
|
||||||
if not s3_url and 'S3_URL' in os.environ:
|
if not s3_url and 'S3_URL' in os.environ:
|
||||||
s3_url = os.environ['S3_URL']
|
s3_url = os.environ['S3_URL']
|
||||||
|
|
Loading…
Reference in a new issue