mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
[cloud] Bugfix for aws_s3 empty directory creation (#32169)
* [cloud] Bugfix for aws_s3 empty directory creation * Update integration tests
This commit is contained in:
parent
0b357ba223
commit
838c1ba6c7
3 changed files with 47 additions and 17 deletions
|
@ -408,12 +408,10 @@ def create_dirkey(module, s3, bucket, obj):
|
|||
if module.check_mode:
|
||||
module.exit_json(msg="PUT operation skipped - running in check mode", changed=True)
|
||||
try:
|
||||
bucket = s3.Bucket(bucket)
|
||||
key = bucket.new_key(obj)
|
||||
key.set_contents_from_string('')
|
||||
s3.put_object(Bucket=bucket, Key=obj, Body=b'')
|
||||
for acl in module.params.get('permission'):
|
||||
s3.put_object_acl(ACL=acl, Bucket=bucket, Key=obj)
|
||||
module.exit_json(msg="Virtual directory %s created in bucket %s" % (obj, bucket.name), changed=True)
|
||||
module.exit_json(msg="Virtual directory %s created in bucket %s" % (obj, bucket), changed=True)
|
||||
except botocore.exceptions.ClientError as e:
|
||||
module.fail_json(msg="Failed while creating object %s." % obj, exception=traceback.format_exc(), **camel_dict_to_snake_dict(e.response))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue