Module: check_mk
Branch: master
Commit: f471a16fb8cdabb3263bf42ebe6da07d09a00a4b
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f471a16fb8cdab…
Author: Andreas <ab(a)mathias-kettner.de>
Date: Fri Jun 29 10:13:45 2018 +0200
Revert "Remove finally statement causing PID file to be removed after bail_out
call"
This reverts commit a788c0f978058ec03fb6fefa0a58a588dde1e4bb.
---
cmk/ec/main.py | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/cmk/ec/main.py b/cmk/ec/main.py
index 69fdd10..fcf02ea 100644
--- a/cmk/ec/main.py
+++ b/cmk/ec/main.py
@@ -4029,16 +4029,12 @@ def main():
raise
bail_out(logger, traceback.format_exc())
- # BEWARE: This cleanup shoud *only* run, if bail_out
- # in the previous except block was *not* executed.
- # If we use a finally statement here, it *will* execute,
- # because bail_out's sys.exit(1) statement raises a SystemExit
- # exception, and Python *would* run this finally-Block.
- if cmk.store.have_lock(str(pid_path)):
- try:
- pid_path.unlink()
- except OSError:
- pass
+ finally:
+ if cmk.store.have_lock(str(pid_path)):
+ try:
+ pid_path.unlink()
+ except OSError:
+ pass
if __name__ == "__main__":