Module: check_mk
Branch: master
Commit: 949c412f0e0e57dd7e1114d3ef8c750c7d20707a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=949c412f0e0e57…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Dec 16 18:07:32 2013 +0100
FIX Generating selection id is hopefully now compatible to more systems
The default mechanism to get a selection id is to generate a UUID by reading
the contents of the file /proc/sys/kernel/random/uuid. This might be not
existing on some special systems. So we use the uuid python module as
fallback now.
---
.werks/368 | 11 +++++++++++
ChangeLog | 1 +
web/htdocs/lib.py | 9 ++++++++-
3 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/.werks/368 b/.werks/368
new file mode 100644
index 0000000..6232a98
--- /dev/null
+++ b/.werks/368
@@ -0,0 +1,11 @@
+Title: Generating selection id is hopefully now compatible to more systems
+Level: 1
+Component: multisite
+Version: 1.2.5i1
+Date: 1387213529
+Class: fix
+
+The default mechanism to get a selection id is to generate a UUID by reading
+the contents of the file /proc/sys/kernel/random/uuid. This might be not
+existing on some special systems. So we use the uuid python module as
+fallback now.
diff --git a/ChangeLog b/ChangeLog
index 3d34acb..840ead5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -47,6 +47,7 @@
* 0327 FIX: Most forms did now work with "Profile Requests" enabled...
* 0333 FIX: Fixed too long page title during performing several actions...
* 0356 FIX: Fixed exception caused by utf8 chars in tooltip text...
+ * 0368 FIX: Generating selection id is hopefully now compatible to more systems...
WATO:
* 0308 Multisite can now set rotation view permissions for NagVis...
diff --git a/web/htdocs/lib.py b/web/htdocs/lib.py
index ca826af..f219dc2 100644
--- a/web/htdocs/lib.py
+++ b/web/htdocs/lib.py
@@ -126,7 +126,14 @@ def savefloat(f):
# Generates a unique id
def gen_id():
- return file('/proc/sys/kernel/random/uuid').read().strip()
+ try:
+ return file('/proc/sys/kernel/random/uuid').read().strip()
+ except IOError:
+ # On platforms where the above file does not exist we try to
+ # use the python uuid module which seems to be a good fallback
+ # for those systems. Well, if got python < 2.5 you are lost for now.
+ import uuid
+ return str(uuid.uuid4())
# Load all files below share/check_mk/web/plugins/WHAT into a
# specified context (global variables). Also honors the