From b9b08666f5884fe9b247b1047c4d4c1759701016 Mon Sep 17 00:00:00 2001 From: Yoichi Imai Date: Fri, 8 Jan 2016 13:05:31 +0900 Subject: [PATCH] Fix iam_policy pdoc variable --- lib/ansible/modules/cloud/amazon/iam_policy.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/cloud/amazon/iam_policy.py b/lib/ansible/modules/cloud/amazon/iam_policy.py index 8b377e1bfe2..81a8245b4ff 100644 --- a/lib/ansible/modules/cloud/amazon/iam_policy.py +++ b/lib/ansible/modules/cloud/amazon/iam_policy.py @@ -303,10 +303,11 @@ def main(): pdoc = json.dumps(json.load(json_data)) json_data.close() elif module.params.get('policy_json') != None: + pdoc = module.params.get('policy_json') # if its a string, assume it is already JSON if not isinstance(pdoc, basestring): try: - pdoc = json.dumps(module.params.get('policy_json')) + pdoc = json.dumps(pdoc) except Exception as e: module.fail_json(msg='Failed to convert the policy into valid JSON: %s' % str(e)) else: