Module: check_mk
Branch: master
Commit: ab71768bdfb2de77f70e15363f80b9ee7fad2076
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ab71768bdfb2de…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Thu Dec 19 18:46:51 2013 +0100
FIX Backup & Restore: Snapshot comments now support unicode character
Unicode comments got truncated in the snapshot file because
of an incorrect byte count in the original unicode string.
---
.werks/248 | 11 +++++++++++
ChangeLog | 1 +
modules/automation.py | 7 +++----
3 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/.werks/248 b/.werks/248
new file mode 100644
index 0000000..cd24873
--- /dev/null
+++ b/.werks/248
@@ -0,0 +1,11 @@
+Title: Backup & Restore: Snapshot comments now support unicode character
+Level: 1
+Component: wato
+Class: fix
+State: unknown
+Version: 1.2.5i1
+Date: 1387475087
+Targetversion: future
+
+Unicode comments got truncated in the snapshot file because
+of an incorrect byte count in the original unicode string.
diff --git a/ChangeLog b/ChangeLog
index ba499b9..f8fe10f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -121,6 +121,7 @@
* 0415 FIX: LDAP: The LDAP Settings dialog is now disabled when the LDAP Connector is
disabled
* 0416 FIX: When doing user sync on user page rendering, contact group memberships
are shown correctly now...
* 0417 FIX: LDAP: Fixed "Sync-Plugin: Roles" test with OpenLDAP
+ * 0248 FIX: Backup & Restore: Snapshot comments now support unicode character...
Notifications:
* 0362 sms: now searching PATH for sendsms and smssend commands...
diff --git a/modules/automation.py b/modules/automation.py
index 9b321b4..cc86a98 100644
--- a/modules/automation.py
+++ b/modules/automation.py
@@ -781,7 +781,7 @@ def automation_create_snapshot(args):
if domain:
statusinfo[domain] = infotext
statusfile = file(filename_status, "w")
- statusfile.write("comment:%s\n" %
data.get("comment"," "))
+ statusfile.write("comment:%s\n" %
data.get("comment"," ").encode("utf-8"))
status_list = list(statusinfo.items())
status_list.sort()
for status in status_list:
@@ -849,8 +849,8 @@ def automation_create_snapshot(args):
# Add comment to tar file
if data.get("comment"):
tarinfo = get_basic_tarinfo("comment")
- tarinfo.size = len(data.get("comment"))
- tar_in_progress.addfile(tarinfo,
cStringIO.StringIO(data.get("comment")))
+ tarinfo.size = len(data.get("comment").encode("utf-8"))
+ tar_in_progress.addfile(tarinfo,
cStringIO.StringIO(data.get("comment").encode("utf-8")))
if data.get("created_by"):
tarinfo = get_basic_tarinfo("created_by")
@@ -895,4 +895,3 @@ def automation_create_snapshot(args):
except Exception, e:
raise MKAutomationError(str(e))
-