Commit 21512a51 authored by Alexandre Boyer's avatar Alexandre Boyer
Browse files

fix status

parent 791b2088
Pipeline #124370 passed with stage
in 39 seconds
......@@ -25,9 +25,7 @@ class StatusFactory():
command_states_log = os.path.join(path, states_filename)
json_command_states = {}
if not os.path.isfile(command_states_log) or os.stat(command_states_log).st_size == 0:
StatusFactory.generate_file(command_states_log, public_subcommands, json_command_states)
else:
if os.path.isfile(command_states_log) and os.stat(command_states_log).st_size != 0:
with open(command_states_log, 'r') as f:
try:
json_command_states = json.load(f)
......@@ -37,8 +35,11 @@ class StatusFactory():
except:
logging.warning("Status monitoring improperly terminated: status reset")
os.remove(states_filename)
if not os.path.isfile(command_states_log) or os.stat(command_states_log).st_size == 0:
StatusFactory.generate_file(command_states_log, public_subcommands, json_command_states)
with open(command_states_log, 'w+') as f:
json.dump(json_command_states, f)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment