From e25605cd5bca003a5071aebbdaeb2887e8e5c659 Mon Sep 17 00:00:00 2001 From: Jens Carl Date: Fri, 25 Sep 2015 21:59:14 +0000 Subject: [PATCH 1/2] Fix to handle user directory within parameter 'template'. --- cloud/amazon/cloudformation.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cloud/amazon/cloudformation.py b/cloud/amazon/cloudformation.py index 236bc89000d..d754ee4bf24 100644 --- a/cloud/amazon/cloudformation.py +++ b/cloud/amazon/cloudformation.py @@ -146,6 +146,7 @@ EXAMPLES = ''' ''' import json +import os import time import yaml @@ -269,7 +270,7 @@ def main(): module.fail_json('Module parameter "template" or "template_url" is required if "state" is "present"') if module.params['template'] is not None: - template_body = open(module.params['template'], 'r').read() + template_body = open(os.path.expanduser(module.params['template']), 'r').read() else: template_body = None From dc109387bdf7331d5022c27f2c4e1a99835c7b91 Mon Sep 17 00:00:00 2001 From: Jens Carl Date: Mon, 28 Sep 2015 18:25:23 +0000 Subject: [PATCH 2/2] Change type of parameter 'template' to 'path'. --- cloud/amazon/cloudformation.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cloud/amazon/cloudformation.py b/cloud/amazon/cloudformation.py index d754ee4bf24..7c9f48148ce 100644 --- a/cloud/amazon/cloudformation.py +++ b/cloud/amazon/cloudformation.py @@ -146,7 +146,6 @@ EXAMPLES = ''' ''' import json -import os import time import yaml @@ -242,7 +241,7 @@ def main(): stack_name=dict(required=True), template_parameters=dict(required=False, type='dict', default={}), state=dict(default='present', choices=['present', 'absent']), - template=dict(default=None, required=False), + template=dict(default=None, required=False, type='path'), notification_arns=dict(default=None, required=False), stack_policy=dict(default=None, required=False), disable_rollback=dict(default=False, type='bool'), @@ -270,7 +269,7 @@ def main(): module.fail_json('Module parameter "template" or "template_url" is required if "state" is "present"') if module.params['template'] is not None: - template_body = open(os.path.expanduser(module.params['template']), 'r').read() + template_body = open(module.params['template'], 'r').read() else: template_body = None