From 26374d89a071945b95da7af4d04ba4da68d90dd6 Mon Sep 17 00:00:00 2001 From: Justin Ludwig Date: Tue, 26 Nov 2013 19:29:06 -0800 Subject: [PATCH] Fix AWS credential params for s3 and other modules The `ec2_ami`, `ec2_elb`, `ec2_tag`, `ec2_vpc`, `route53`, and `s3` modules all canonicalize the AWS access and secret key params as `aws_access_key` and `aws_secret_key`. However, following the fixes for #4540, those modules now use `get_ec2_creds` from `lib/ansible/module_utils/ec2.py`, which requires access/secret key params to be canonicalized as `ec2_access_key` and `ec2_secret_key`. As a result, AWS credentials passed to those six modules as parameters are ignored (they instead always use the AWS credentials specified via environment variables, or nothing). So this change fixes those six modules to canonicalize the AWS access and secret key params as `ec2_access_key` and `ec2_secret_key`, allowing them to again accept AWS credentials passed via module params. --- library/cloud/ec2_ami | 4 ++-- library/cloud/ec2_elb | 4 ++-- library/cloud/ec2_tag | 4 ++-- library/cloud/ec2_vpc | 4 ++-- library/cloud/route53 | 4 ++-- library/cloud/s3 | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/library/cloud/ec2_ami b/library/cloud/ec2_ami index f849a2d38fd..a3e20bcfd1e 100644 --- a/library/cloud/ec2_ami +++ b/library/cloud/ec2_ami @@ -264,8 +264,8 @@ def main(): module = AnsibleModule( argument_spec = dict( ec2_url = dict(), - aws_secret_key = dict(aliases=['ec2_secret_key', 'secret_key'], no_log=True), - aws_access_key = dict(aliases=['ec2_access_key', 'access_key']), + ec2_secret_key = dict(aliases=['aws_secret_key', 'secret_key'], no_log=True), + ec2_access_key = dict(aliases=['aws_access_key', 'access_key']), instance_id = dict(), image_id = dict(), delete_snapshot = dict(), diff --git a/library/cloud/ec2_elb b/library/cloud/ec2_elb index df032e5c616..e7925a5741f 100644 --- a/library/cloud/ec2_elb +++ b/library/cloud/ec2_elb @@ -257,8 +257,8 @@ def main(): 'choices': ['present', 'absent']}, instance_id={'required': True}, ec2_elbs={'default': None, 'required': False, 'type':'list'}, - aws_secret_key={'default': None, 'aliases': ['ec2_secret_key', 'secret_key'], 'no_log': True}, - aws_access_key={'default': None, 'aliases': ['ec2_access_key', 'access_key']}, + ec2_secret_key={'default': None, 'aliases': ['aws_secret_key', 'secret_key'], 'no_log': True}, + ec2_access_key={'default': None, 'aliases': ['aws_access_key', 'access_key']}, region={'default': None, 'required': False, 'aliases':['aws_region', 'ec2_region'], 'choices':AWS_REGIONS}, enable_availability_zone={'default': True, 'required': False, 'choices': BOOLEANS, 'type': 'bool'}, wait={'required': False, 'choices': BOOLEANS, 'default': True, 'type': 'bool'} diff --git a/library/cloud/ec2_tag b/library/cloud/ec2_tag index 8f5a5d37c5e..7ea2e8dab61 100644 --- a/library/cloud/ec2_tag +++ b/library/cloud/ec2_tag @@ -118,8 +118,8 @@ def main(): region = dict(aliases=['aws_region', 'ec2_region'], choices=AWS_REGIONS), state = dict(choices=['present', 'absent']), ec2_url = dict(aliases=['EC2_URL']), - aws_secret_key = dict(aliases=['ec2_secret_key', 'secret_key'], no_log=True), - aws_access_key = dict(aliases=['ec2_access_key', 'access_key']), + ec2_secret_key = dict(aliases=['aws_secret_key', 'secret_key'], no_log=True), + ec2_access_key = dict(aliases=['aws_access_key', 'access_key']), ) ) diff --git a/library/cloud/ec2_vpc b/library/cloud/ec2_vpc index 0f3c1bef37e..28804a26a4a 100644 --- a/library/cloud/ec2_vpc +++ b/library/cloud/ec2_vpc @@ -489,8 +489,8 @@ def main(): route_tables = dict(type='list'), region = dict(aliases=['aws_region', 'ec2_region'], choices=AWS_REGIONS), state = dict(choices=['present', 'absent'], default='present'), - aws_secret_key = dict(aliases=['ec2_secret_key', 'secret_key'], no_log=True), - aws_access_key = dict(aliases=['ec2_access_key', 'access_key']), + ec2_secret_key = dict(aliases=['aws_secret_key', 'secret_key'], no_log=True), + ec2_access_key = dict(aliases=['aws_access_key', 'access_key']), ) ) diff --git a/library/cloud/route53 b/library/cloud/route53 index 4e3051feea2..f9ecfc35ddf 100644 --- a/library/cloud/route53 +++ b/library/cloud/route53 @@ -153,8 +153,8 @@ def main(): ttl = dict(required=False, default=3600), type = dict(choices=['A', 'CNAME', 'MX', 'AAAA', 'TXT', 'PTR', 'SRV', 'SPF', 'NS'], required=True), value = dict(required=False), - aws_secret_key = dict(aliases=['ec2_secret_key', 'secret_key'], no_log=True, required=False), - aws_access_key = dict(aliases=['ec2_access_key', 'access_key'], required=False), + ec2_secret_key = dict(aliases=['aws_secret_key', 'secret_key'], no_log=True, required=False), + ec2_access_key = dict(aliases=['aws_access_key', 'access_key'], required=False), overwrite = dict(required=False, type='bool') ) ) diff --git a/library/cloud/s3 b/library/cloud/s3 index fcacaadeb25..5d2c97baf39 100644 --- a/library/cloud/s3 +++ b/library/cloud/s3 @@ -258,8 +258,8 @@ def main(): mode = dict(choices=['get', 'put', 'delete', 'create', 'geturl', 'getstr'], required=True), expiry = dict(default=600, aliases=['expiration']), s3_url = dict(aliases=['S3_URL']), - aws_secret_key = dict(aliases=['ec2_secret_key', 'secret_key'], no_log=True, required=False), - aws_access_key = dict(aliases=['ec2_access_key', 'access_key'], required=False), + ec2_secret_key = dict(aliases=['aws_secret_key', 'secret_key'], no_log=True), + ec2_access_key = dict(aliases=['aws_access_key', 'access_key']), overwrite = dict(aliases=['force'], default=True, type='bool'), ), )