From bfa63e01e5c8dd225217cae97ac42232139b2dcd Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Fri, 19 Jun 2015 12:10:14 -0400 Subject: [PATCH] also fixed exceptions --- lib/ansible/modules/extras/monitoring/sensu_check.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/extras/monitoring/sensu_check.py b/lib/ansible/modules/extras/monitoring/sensu_check.py index eb9d0b7bf0..5c932a1d30 100644 --- a/lib/ansible/modules/extras/monitoring/sensu_check.py +++ b/lib/ansible/modules/extras/monitoring/sensu_check.py @@ -185,7 +185,7 @@ def sensu_check(module, path, name, state='present', backup=False): try: stream = open(path, 'r') config = json.load(stream.read()) - except IOError as e: + except IOError, e: if e.errno is 2: # File not found, non-fatal if state == 'absent': reasons.append('file did not exist and state is `absent\'') @@ -279,7 +279,7 @@ def sensu_check(module, path, name, state='present', backup=False): try: stream = open(path, 'w') stream.write(json.dumps(config, indent=2) + '\n') - except IOError as e: + except IOError, e: module.fail_json(msg=str(e)) finally: if stream: