From b40a8af999589b4db70f53d41719ee2c4e9471e9 Mon Sep 17 00:00:00 2001 From: Darren Worrall Date: Tue, 15 Sep 2015 16:40:01 +0100 Subject: [PATCH] Initialise `stream` variable Fixes `UnboundLocalError: local variable 'stream' referenced before assignment` when the check path doesnt exist --- lib/ansible/modules/extras/monitoring/sensu_check.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/ansible/modules/extras/monitoring/sensu_check.py b/lib/ansible/modules/extras/monitoring/sensu_check.py index a1bd36ca66..e1c51463ae 100644 --- a/lib/ansible/modules/extras/monitoring/sensu_check.py +++ b/lib/ansible/modules/extras/monitoring/sensu_check.py @@ -182,6 +182,7 @@ def sensu_check(module, path, name, state='present', backup=False): except ImportError: import simplejson as json + stream = None try: try: stream = open(path, 'r')