diff options
Diffstat (limited to 'utilities/logic/async_status.py')
-rw-r--r-- | utilities/logic/async_status.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/utilities/logic/async_status.py b/utilities/logic/async_status.py index a35f3c0c..7c3d458f 100644 --- a/utilities/logic/async_status.py +++ b/utilities/logic/async_status.py @@ -76,11 +76,13 @@ def main(): # no remote kill mode currently exists, but probably should # consider log_path + ".pid" file and also unlink that above - data = file(log_path).read() + data = None try: + data = file(log_path).read() + import q; q(data) data = json.loads(data) except Exception: - if data == '': + if not data: # file not written yet? That means it is running module.exit_json(results_file=log_path, ansible_job_id=jid, started=1, finished=0) else: @@ -90,6 +92,8 @@ def main(): if not 'started' in data: data['finished'] = 1 data['ansible_job_id'] = jid + elif 'finished' not in data: + data['finished'] = 0 # Fix error: TypeError: exit_json() keywords must be strings data = dict([(str(k), v) for k, v in data.iteritems()]) |