Fix iam_policy pdoc variable

pull/18777/head
Yoichi Imai 9 years ago committed by Matt Clay
parent ef3308159f
commit b9b08666f5

@ -303,10 +303,11 @@ def main():
pdoc = json.dumps(json.load(json_data)) pdoc = json.dumps(json.load(json_data))
json_data.close() json_data.close()
elif module.params.get('policy_json') != None: elif module.params.get('policy_json') != None:
pdoc = module.params.get('policy_json')
# if its a string, assume it is already JSON # if its a string, assume it is already JSON
if not isinstance(pdoc, basestring): if not isinstance(pdoc, basestring):
try: try:
pdoc = json.dumps(module.params.get('policy_json')) pdoc = json.dumps(pdoc)
except Exception as e: except Exception as e:
module.fail_json(msg='Failed to convert the policy into valid JSON: %s' % str(e)) module.fail_json(msg='Failed to convert the policy into valid JSON: %s' % str(e))
else: else:

Loading…
Cancel
Save