Module: check_mk
Branch: master
Commit: fc519a21c8a878af8e0175437c2621037d78fdac
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=fc519a21c8a878…
Author: Konstantin Büttner <kb(a)mathias-kettner.de>
Date: Fri Jul 13 10:49:09 2018 +0200
6227 FIX Fix failing termination or config reload
Change-Id: Ifb0b0e0a2aa49cc12c54bea618ccf7f4b6c756e2
---
.werks/6227 | 10 +++++++++
cmk/ec/main.py | 69 +++++++++++++++++++++++++++++-----------------------------
2 files changed, 45 insertions(+), 34 deletions(-)
diff --git a/.werks/6227 b/.werks/6227
new file mode 100644
index 0000000..a4ee1a4
--- /dev/null
+++ b/.werks/6227
@@ -0,0 +1,10 @@
+Title: Fix failing termination or config reload
+Level: 2
+Component: ec
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1531469606
+
diff --git a/cmk/ec/main.py b/cmk/ec/main.py
index 93a0386..0a0526e 100644
--- a/cmk/ec/main.py
+++ b/cmk/ec/main.py
@@ -3183,35 +3183,41 @@ def run_eventd(terminate_main_event, settings, config, lock_configuration, histo
while not terminate_main_event.is_set():
try:
- # Wait until either housekeeping or retention is due, but at
- # maximum 60 seconds. That way changes of the interval from a very
- # high to a low value will never require more than 60 seconds
-
- event_list = [next_housekeeping, next_retention, next_statistics]
- if is_replication_slave(config):
- event_list.append(next_replication)
-
- time_left = max(0, min(event_list) - time.time())
- time.sleep(min(time_left, 60))
-
- now = time.time()
- if now > next_housekeeping:
- event_server.do_housekeeping()
- next_housekeeping = now + config["housekeeping_interval"]
-
- if now > next_retention:
- with event_status.lock:
- event_status.save_status()
- next_retention = now + config["retention_interval"]
-
- if now > next_statistics:
- perfcounters.do_statistics()
- next_statistics = now + config["statistics_interval"]
-
- # Beware: replication might be turned on during this loop!
- if is_replication_slave(config) and now > next_replication:
- replication_pull(settings, config, lock_configuration, perfcounters, event_status, event_server, slave_status, logger)
- next_replication = now + config["replication"]["interval"]
+ try:
+ # Wait until either housekeeping or retention is due, but at
+ # maximum 60 seconds. That way changes of the interval from a very
+ # high to a low value will never require more than 60 seconds
+
+ event_list = [next_housekeeping, next_retention, next_statistics]
+ if is_replication_slave(config):
+ event_list.append(next_replication)
+
+ time_left = max(0, min(event_list) - time.time())
+ time.sleep(min(time_left, 60))
+
+ now = time.time()
+ if now > next_housekeeping:
+ event_server.do_housekeeping()
+ next_housekeeping = now + config["housekeeping_interval"]
+
+ if now > next_retention:
+ with event_status.lock:
+ event_status.save_status()
+ next_retention = now + config["retention_interval"]
+
+ if now > next_statistics:
+ perfcounters.do_statistics()
+ next_statistics = now + config["statistics_interval"]
+
+ # Beware: replication might be turned on during this loop!
+ if is_replication_slave(config) and now > next_replication:
+ replication_pull(settings, config, lock_configuration, perfcounters, event_status, event_server, slave_status, logger)
+ next_replication = now + config["replication"]["interval"]
+ except Exception as e:
+ logger.exception("Exception in main thread:\n%s" % e)
+ if settings.options.debug:
+ raise
+ time.sleep(1)
except MKSignalException as e:
if e._signum == 1:
logger.info("Received SIGHUP - going to reload configuration")
@@ -3219,11 +3225,6 @@ def run_eventd(terminate_main_event, settings, config, lock_configuration, histo
else:
logger.info("Signalled to death by signal %d" % e._signum)
terminate(terminate_main_event, event_server, status_server)
- except Exception as e:
- logger.exception("Exception in main thread:\n%s" % e)
- if settings.options.debug:
- raise
- time.sleep(1)
# Now wait for termination of the server threads
event_server.join()
Module: check_mk
Branch: master
Commit: ccaf3ca92103ca3cab24fe0b7c1b21b8104720ff
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ccaf3ca92103ca…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Fri Jul 13 10:19:53 2018 +0200
Fixed and enabled old-style-class warnings.
Change-Id: I5eab9793142a05f7a3f7505904af7db4c94af2a8
---
cmk/gui/watolib.py | 3 +--
tests/pylint/pylintrc | 3 +--
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/cmk/gui/watolib.py b/cmk/gui/watolib.py
index d1da847..b0c8f3f 100644
--- a/cmk/gui/watolib.py
+++ b/cmk/gui/watolib.py
@@ -3080,9 +3080,8 @@ class CREHost(WithPermissionsAndAttributes):
# | hosts. Examples are the IP address and the host tags. |
# '----------------------------------------------------------------------'
-# TODO: Make new style class
# TODO: Refactor declare_host_attribute() setting private attributes here
-class Attribute:
+class Attribute(object):
# The constructor stores name and title. If those are
# dynamic then leave them out and override name() and
# title()
diff --git a/tests/pylint/pylintrc b/tests/pylint/pylintrc
index 5ce8339..c4e80d4 100644
--- a/tests/pylint/pylintrc
+++ b/tests/pylint/pylintrc
@@ -77,9 +77,8 @@ disable=
wrong-import-order,
wrong-import-position,
#---------------------------------------------------------------------------
- # The 5 warnings below have already been fixed for non-web/ code. When the
+ # The 4 warnings below have already been fixed for non-web/ code. When the
# upcoming reorganization of web/ has been landed, these should be fixed first.
- old-style-class,
simplifiable-if-statement,
unnecessary-lambda,
unnecessary-pass,
Module: check_mk
Branch: master
Commit: 36d49614b742618514698a5eaaf751aa8b709fde
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=36d49614b74261…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Jul 13 09:06:36 2018 +0200
Fixed missing _ in cmk code after making pylint check for this variable
Change-Id: Ic27056e5e5f532a6f331d5e8b7d5cb54c07248d2
---
cmk/__init__.py | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/cmk/__init__.py b/cmk/__init__.py
index f4e87f0..d0cec5b 100644
--- a/cmk/__init__.py
+++ b/cmk/__init__.py
@@ -36,6 +36,14 @@ import os
import cmk.paths
from cmk.exceptions import MKGeneralException
+# TODO: Clean this up one day by using the way recommended by gettext.
+# (See https://docs.python.org/2/library/gettext.html). For this we
+# need the path to the locale files here.
+try:
+ _
+except NameError:
+ _ = lambda x: x # Fake i18n when not available
+
def omd_version():
return os.path.basename(os.readlink(cmk.paths.omd_root + "/version"))