Module: check_mk
Branch: master
Commit: 3679f243e3f7da72558a0bd6ec7ebbc1b1c56bfb
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3679f243e3f7da…
Author: Andreas <ab(a)mathias-kettner.de>
Date: Wed Jun 6 11:34:02 2018 +0200
5815 FIX Background Job/User synchronization: Fixed text encoding bug / Fixed incorrect
exception message
The user synchronsation background incorrectly reported an exception instead of a progress
update.
However, this didn't affect the outcome of the operation, so no actual harm was done.
Furthermore, umlauts in info messages no longer cause exceptions.
Change-Id: I84a81104adf82eaf36e995936be341bcde31af9c
---
.werks/5815 | 14 ++++++++++++++
web/htdocs/background_job.py | 6 +++---
web/htdocs/userdb.py | 2 +-
3 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/.werks/5815 b/.werks/5815
new file mode 100644
index 0000000..7c93a4c
--- /dev/null
+++ b/.werks/5815
@@ -0,0 +1,14 @@
+Title: Background Job/User synchronization: Fixed text encoding bug / Fixed incorrect
exception message
+Level: 1
+Component: wato
+Compatible: compat
+Edition: cre
+Version: 1.6.0i1
+Date: 1528277414
+Class: fix
+
+The user synchronsation background incorrectly reported an exception instead of a
progress update.
+However, this didn't affect the outcome of the operation, so no actual harm was
done.
+
+
+Furthermore, umlauts in info messages no longer cause exceptions.
diff --git a/web/htdocs/background_job.py b/web/htdocs/background_job.py
index c4ee6ed..269be3a 100644
--- a/web/htdocs/background_job.py
+++ b/web/htdocs/background_job.py
@@ -82,19 +82,19 @@ class BackgroundProcessInterface(object):
@classmethod
def send_progress_update(cls, info):
- print "%s:%s" % (cls.progress_update_message, info)
+ print "%s:%s" % (cls.progress_update_message,
info.encode("utf-8"))
@classmethod
def send_result_message(cls, info):
- print "%s:%s" % (cls.result_message, info)
+ print "%s:%s" % (cls.result_message, info.encode("utf-8"))
@classmethod
def send_exception(cls, info):
# Exceptions get an extra newline
# Some error messages tend not output a \n at the end..
- print "\n%s:%s" % (cls.exception_message, info)
+ print "\n%s:%s" % (cls.exception_message,
info.encode("utf-8"))
@classmethod
diff --git a/web/htdocs/userdb.py b/web/htdocs/userdb.py
index 15de15c..a22ed97 100644
--- a/web/htdocs/userdb.py
+++ b/web/htdocs/userdb.py
@@ -1370,7 +1370,7 @@ class UserSyncBackgroundJob(gui_background_job.GUIBackgroundJob):
job_interface.send_progress_update(_("[%s] Starting sync for
connection") % connection_id)
connection.do_sync(add_to_changelog=add_to_changelog,
only_username=False)
- job_interface.send_exception(_("[%s] Finished sync for
connection") % connection_id)
+ job_interface.send_progress_update(_("[%s] Finished sync for
connection") % connection_id)
except Exception, e:
job_interface.send_exception(_("[%s] Exception: %s") %
(connection_id, e))
logger.error('Exception (%s, userdb_job): %s' %