commit
7303093f35
1 changed files with 5 additions and 4 deletions
7
cloud/s3
7
cloud/s3
|
@ -248,7 +248,7 @@ def main():
|
||||||
bucket = dict(required=True),
|
bucket = dict(required=True),
|
||||||
object = dict(),
|
object = dict(),
|
||||||
src = dict(),
|
src = dict(),
|
||||||
dest = dict(),
|
dest = dict(default=None),
|
||||||
mode = dict(choices=['get', 'put', 'delete', 'create', 'geturl', 'getstr'], required=True),
|
mode = dict(choices=['get', 'put', 'delete', 'create', 'geturl', 'getstr'], required=True),
|
||||||
expiry = dict(default=600, aliases=['expiration']),
|
expiry = dict(default=600, aliases=['expiration']),
|
||||||
s3_url = dict(aliases=['S3_URL']),
|
s3_url = dict(aliases=['S3_URL']),
|
||||||
|
@ -261,6 +261,7 @@ def main():
|
||||||
bucket = module.params.get('bucket')
|
bucket = module.params.get('bucket')
|
||||||
obj = module.params.get('object')
|
obj = module.params.get('object')
|
||||||
src = module.params.get('src')
|
src = module.params.get('src')
|
||||||
|
if module.params.get('dest'):
|
||||||
dest = os.path.expanduser(module.params.get('dest'))
|
dest = os.path.expanduser(module.params.get('dest'))
|
||||||
mode = module.params.get('mode')
|
mode = module.params.get('mode')
|
||||||
expiry = int(module.params['expiry'])
|
expiry = int(module.params['expiry'])
|
||||||
|
@ -404,7 +405,7 @@ def main():
|
||||||
if deletertn is True:
|
if deletertn is True:
|
||||||
module.exit_json(msg="Bucket %s and all keys have been deleted."%bucket, changed=True)
|
module.exit_json(msg="Bucket %s and all keys have been deleted."%bucket, changed=True)
|
||||||
else:
|
else:
|
||||||
module.fail_json(msg="Bucket does not exist.", failed=True)
|
module.fail_json(msg="Bucket does not exist.", changed=False)
|
||||||
else:
|
else:
|
||||||
module.fail_json(msg="Bucket parameter is required.", failed=True)
|
module.fail_json(msg="Bucket parameter is required.", failed=True)
|
||||||
|
|
||||||
|
@ -416,7 +417,7 @@ def main():
|
||||||
if bucketrtn is True:
|
if bucketrtn is True:
|
||||||
module.exit_json(msg="Bucket already exists.", changed=False)
|
module.exit_json(msg="Bucket already exists.", changed=False)
|
||||||
else:
|
else:
|
||||||
created = create_bucket(module, s3, bucket)
|
module.exit_json(msg="Bucket created succesfully", changed=create_bucket(module, s3, bucket))
|
||||||
if bucket and obj:
|
if bucket and obj:
|
||||||
bucketrtn = bucket_check(module, s3, bucket)
|
bucketrtn = bucket_check(module, s3, bucket)
|
||||||
if obj.endswith('/'):
|
if obj.endswith('/'):
|
||||||
|
|
Loading…
Reference in a new issue