From 1e5ca511d6fa481fd096140a907f2bc2e20a87df Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Tue, 26 Jul 2016 09:52:16 -0400 Subject: [PATCH] now using type=json which takes care of str/dict --- lib/ansible/modules/extras/cloud/amazon/s3_bucket.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/lib/ansible/modules/extras/cloud/amazon/s3_bucket.py b/lib/ansible/modules/extras/cloud/amazon/s3_bucket.py index 7464f76f0a..67b5b134ee 100644 --- a/lib/ansible/modules/extras/cloud/amazon/s3_bucket.py +++ b/lib/ansible/modules/extras/cloud/amazon/s3_bucket.py @@ -203,13 +203,7 @@ def _create_or_update_bucket(connection, module, location): module.fail_json(msg=e.message) if policy is not None: - # Deal with policy if either JSON formatted string or just data structure - if isinstance(policy, basestring): - compare_policy = json.dumps(policy) - load_policy = policy - else: - compare_policy = policy - load_policy = json.loads(policy) + compare_policy = json.loads(policy) if current_policy is None or json.loads(current_policy) != compare_policy: try: @@ -350,7 +344,7 @@ def main(): argument_spec.update( dict( force = dict(required=False, default='no', type='bool'), - policy = dict(required=False), + policy = dict(required=False, type='json'), name = dict(required=True, type='str'), requester_pays = dict(default='no', type='bool'), s3_url = dict(aliases=['S3_URL'], type='str'),