From 2f7bfd82738640987ebad776c95897a89ff5b4ec Mon Sep 17 00:00:00 2001 From: Shayne Clausson Date: Mon, 17 Aug 2015 12:51:10 +0200 Subject: [PATCH] fixes issue where no range_key_name is defined https://github.com/ansible/ansible-modules-extras/issues/841 --- .../modules/extras/cloud/amazon/dynamodb_table.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/ansible/modules/extras/cloud/amazon/dynamodb_table.py b/lib/ansible/modules/extras/cloud/amazon/dynamodb_table.py index c97ff6f0be0..29ba230fe48 100644 --- a/lib/ansible/modules/extras/cloud/amazon/dynamodb_table.py +++ b/lib/ansible/modules/extras/cloud/amazon/dynamodb_table.py @@ -143,10 +143,15 @@ def create_or_update_dynamo_table(connection, module): read_capacity = module.params.get('read_capacity') write_capacity = module.params.get('write_capacity') - schema = [ - HashKey(hash_key_name, DYNAMO_TYPE_MAP.get(hash_key_type)), - RangeKey(range_key_name, DYNAMO_TYPE_MAP.get(range_key_type)) - ] + if range_key_name: + schema = [ + HashKey(hash_key_name, DYNAMO_TYPE_MAP.get(hash_key_type)), + RangeKey(range_key_name, DYNAMO_TYPE_MAP.get(range_key_type)) + ] + else: + schema = [ + HashKey(hash_key_name, DYNAMO_TYPE_MAP.get(hash_key_type)) + ] throughput = { 'read': read_capacity, 'write': write_capacity