Skip to content

Commit

Permalink
Big Black PR (ansible-collections#1784)
Browse files Browse the repository at this point in the history
* Black prep

* Black

* changelog

* Fix pylint unused-import in tests

* Split SSM connection plugin changes

* disable glue tests - bucket's missing

* Disable s3_logging and s3_sync tests

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections@2c4575c
  • Loading branch information
tremble authored and alinabuzachis committed Oct 6, 2023
1 parent a9def46 commit a042a4f
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions plugins/modules/aws_region_info.py
Expand Up @@ -70,30 +70,29 @@

def main():
argument_spec = dict(
filters=dict(default={}, type='dict')
filters=dict(default={}, type="dict"),
)

module = AnsibleAWSModule(argument_spec=argument_spec, supports_check_mode=True)

connection = module.client('ec2', retry_decorator=AWSRetry.jittered_backoff())
connection = module.client("ec2", retry_decorator=AWSRetry.jittered_backoff())

# Replace filter key underscores with dashes, for compatibility
sanitized_filters = dict(module.params.get('filters'))
for k in module.params.get('filters').keys():
sanitized_filters = dict(module.params.get("filters"))
for k in module.params.get("filters").keys():
if "_" in k:
sanitized_filters[k.replace('_', '-')] = sanitized_filters[k]
sanitized_filters[k.replace("_", "-")] = sanitized_filters[k]
del sanitized_filters[k]

try:
regions = connection.describe_regions(
aws_retry=True,
Filters=ansible_dict_to_boto3_filter_list(sanitized_filters)
aws_retry=True, Filters=ansible_dict_to_boto3_filter_list(sanitized_filters)
)
except (BotoCoreError, ClientError) as e:
module.fail_json_aws(e, msg="Unable to describe regions.")

module.exit_json(regions=[camel_dict_to_snake_dict(r) for r in regions['Regions']])
module.exit_json(regions=[camel_dict_to_snake_dict(r) for r in regions["Regions"]])


if __name__ == '__main__':
if __name__ == "__main__":
main()

0 comments on commit a042a4f

Please sign in to comment.