Commit 5a99329e authored by Łukasz Nowak's avatar Łukasz Nowak Committed by Rafael Monnerat

monitor: Remove bootstrap file on failure only

As bootstrapMonitor is run many times and each execution takes taime it's
better to have the status file there during monitor is running, especially if
previous runs were good.

This file is used by other tools to check last state of bootstrap monitor, and
if it disappears for execution of monitor it can result with false alarms.

/reviewed-on nexedi/slapos.toolbox!70
parent 5be809aa
Pipeline #7007 failed with stage
in 0 seconds
......@@ -354,9 +354,6 @@ class Monitoring(object):
def bootstrapMonitor(self):
if os.path.exists(self.promise_output_file):
os.unlink(self.promise_output_file)
# save pid of current process into file
with open(self.pid_file, 'w') as pid_file:
pid_file.write(str(os.getpid()))
......@@ -378,6 +375,9 @@ class Monitoring(object):
with open(self.promise_output_file, 'w') as promise_file:
promise_file.write("")
print("SUCCESS: bootstrap is OK")
elif os.path.exists(self.promise_output_file):
os.unlink(self.promise_output_file)
return 0
......
Markdown is supported
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