Change s3 module to use shared ec2 authorization module snippet

reviewable/pr18780/r1
James Tanner 11 years ago
parent 55a3411d67
commit d62812b8ee

@ -272,9 +272,9 @@ def main():
mode = module.params.get('mode')
expiry = int(module.params['expiry'])
s3_url = module.params.get('s3_url')
aws_secret_key = module.params.get('aws_secret_key')
aws_access_key = module.params.get('aws_access_key')
overwrite = module.params.get('overwrite')
ec2_url, aws_access_key, aws_secret_key, region = get_ec2_creds(module)
if module.params.get('object'):
obj = os.path.expanduser(module.params['object'])
@ -283,18 +283,6 @@ def main():
if not s3_url and 'S3_URL' in os.environ:
s3_url = os.environ['S3_URL']
if not aws_secret_key:
if 'AWS_SECRET_KEY' in os.environ:
aws_secret_key = os.environ['AWS_SECRET_KEY']
elif 'EC2_SECRET_KEY' in os.environ:
aws_secret_key = os.environ['EC2_SECRET_KEY']
if not aws_access_key:
if 'AWS_ACCESS_KEY' in os.environ:
aws_access_key = os.environ['AWS_ACCESS_KEY']
elif 'EC2_ACCESS_KEY' in os.environ:
aws_access_key = os.environ['EC2_ACCESS_KEY']
# If we have an S3_URL env var set, this is likely to be Walrus, so change connection method
if is_walrus(s3_url):
try:
@ -463,8 +451,8 @@ def main():
module.exit_json(failed=False)
# this is magic, see lib/ansible/module_common.py
#<<INCLUDE_ANSIBLE_MODULE_COMMON>>
# import module snippets
from ansible.module_utils.basic import *
from ansible.module_utils.ec2 import *
main()

Loading…
Cancel
Save