From 7160a491c2bab8fd0b3479c75f3b88f7a5813f73 Mon Sep 17 00:00:00 2001 From: Sloane Hertel Date: Thu, 1 Jun 2017 18:18:02 -0400 Subject: [PATCH] elasticache: add requirements to parameter_group and snapshot (#24904) * Add requirements to elasticache parameter group * add requirements for elasticache_snapshot * pep8 elasticache_snapshot * remove elasticache_snapshot from legacy files --- .../modules/cloud/amazon/elasticache_parameter_group.py | 1 + lib/ansible/modules/cloud/amazon/elasticache_snapshot.py | 8 ++++++-- test/sanity/pep8/legacy-files.txt | 1 - 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/ansible/modules/cloud/amazon/elasticache_parameter_group.py b/lib/ansible/modules/cloud/amazon/elasticache_parameter_group.py index 46a73ef3396..2ade7972b56 100644 --- a/lib/ansible/modules/cloud/amazon/elasticache_parameter_group.py +++ b/lib/ansible/modules/cloud/amazon/elasticache_parameter_group.py @@ -28,6 +28,7 @@ description: - Returns information about the specified cache cluster. version_added: "2.3" author: "Sloane Hertel (@s-hertel)" +requirements: [ boto3, botocore ] options: group_family: description: diff --git a/lib/ansible/modules/cloud/amazon/elasticache_snapshot.py b/lib/ansible/modules/cloud/amazon/elasticache_snapshot.py index cb0f13fd525..3d64874c674 100644 --- a/lib/ansible/modules/cloud/amazon/elasticache_snapshot.py +++ b/lib/ansible/modules/cloud/amazon/elasticache_snapshot.py @@ -28,6 +28,7 @@ description: - Returns information about the specified snapshot. version_added: "2.3" author: "Sloane Hertel (@s-hertel)" +requirements: [ boto3, botocore ] options: name: description: @@ -135,6 +136,7 @@ try: except ImportError: HAS_BOTO3 = False + def create(module, connection, replication_id, cluster_id, name): """ Create an Elasticache backup. """ try: @@ -150,6 +152,7 @@ def create(module, connection, replication_id, cluster_id, name): module.fail_json(msg="Unable to create the snapshot.", exception=traceback.format_exc()) return response, changed + def copy(module, connection, name, target, bucket): """ Copy an Elasticache backup. """ try: @@ -161,6 +164,7 @@ def copy(module, connection, name, target, bucket): module.fail_json(msg="Unable to copy the snapshot.", exception=traceback.format_exc()) return response, changed + def delete(module, connection, name): """ Delete an Elasticache backup. """ try: @@ -198,7 +202,7 @@ def main(): name = module.params.get('name') state = module.params.get('state') - replication_id = module.params.get('replication_id') + replication_id = module.params.get('replication_id') cluster_id = module.params.get('cluster_id') target = module.params.get('target') bucket = module.params.get('bucket') @@ -206,7 +210,7 @@ def main(): # Retrieve any AWS settings from the environment. region, ec2_url, aws_connect_kwargs = get_aws_connection_info(module, boto3=True) if not region: - module.fail_json(msg = str("Either region or AWS_REGION or EC2_REGION environment variable or boto config aws_region or ec2_region must be set.")) + module.fail_json(msg=str("Either region or AWS_REGION or EC2_REGION environment variable or boto config aws_region or ec2_region must be set.")) connection = boto3_conn(module, conn_type='client', resource='elasticache', region=region, diff --git a/test/sanity/pep8/legacy-files.txt b/test/sanity/pep8/legacy-files.txt index 7912b0adfe6..e5085b56986 100644 --- a/test/sanity/pep8/legacy-files.txt +++ b/test/sanity/pep8/legacy-files.txt @@ -103,7 +103,6 @@ lib/ansible/modules/cloud/amazon/ecs_taskdefinition.py lib/ansible/modules/cloud/amazon/efs.py lib/ansible/modules/cloud/amazon/efs_facts.py lib/ansible/modules/cloud/amazon/elasticache.py -lib/ansible/modules/cloud/amazon/elasticache_snapshot.py lib/ansible/modules/cloud/amazon/elasticache_subnet_group.py lib/ansible/modules/cloud/amazon/execute_lambda.py lib/ansible/modules/cloud/amazon/iam.py