Module: check_mk
Branch: master
Commit: 5ec51196007f27b3794920ae6f834fc1a3d8f202
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5ec51196007f27…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Dec 11 22:00:21 2018 +0100
Minor cleanup: Make automations call sys.exit in a central place
Change-Id: Ifefcd9f5c37911914646393b985fb29d4da3fd00
---
cmk_base/automations/__init__.py | 6 +++---
cmk_base/modes/check_mk.py | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/cmk_base/automations/__init__.py b/cmk_base/automations/__init__.py
index 5c87d70..f1c67fe 100644
--- a/cmk_base/automations/__init__.py
+++ b/cmk_base/automations/__init__.py
@@ -80,13 +80,13 @@ class Automations(object):
console.error("%s\n" % cmk_base.utils.make_utf8("%s" %
e))
if cmk.debug.enabled():
raise
- sys.exit(1)
+ return 1
except Exception as e:
if cmk.debug.enabled():
raise
console.error("%s\n" % cmk_base.utils.make_utf8("%s" %
e))
- sys.exit(2)
+ return 2
finally:
profiling.output_profile()
@@ -96,7 +96,7 @@ class Automations(object):
else:
console.output("%r\n" % (result,))
- sys.exit(0)
+ return 0
# Handle generic arguments (currently only the optional timeout argument)
def _handle_generic_arguments(self, args):
diff --git a/cmk_base/modes/check_mk.py b/cmk_base/modes/check_mk.py
index 83f7d9e..bae820b 100644
--- a/cmk_base/modes/check_mk.py
+++ b/cmk_base/modes/check_mk.py
@@ -1387,7 +1387,7 @@ def mode_automation(args):
if not args:
raise automations.MKAutomationError("You need to provide arguments")
- automations.automations.execute(args[0], args[2:])
+ sys.exit(automations.automations.execute(args[0], args[2:]))
modes.register(