Module: check_mk
Branch: master
Commit: 930823f62e21ba238e5183846e9374100ed0583b
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=930823f62e21ba…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Sat Jan 15 17:00:47 2011 +0100
Multisite: new macros for custom notes
$URL_PREFIX$ and $SITE$ now make multi site setups easier
---
ChangeLog | 5 +++++
web/plugins/views/painters.py | 10 +++++++---
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index b14a842..fba3b04 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+1.1.9i5:
+ Multisite:
+ * custom notes: new macros $URL_PREFIX$ and $SITE$, making
+ multi site setups easier
+
1.1.9i4:
Core, Setup, etc.:
* added missing 'register 0' to host template
diff --git a/web/plugins/views/painters.py b/web/plugins/views/painters.py
index e440a6b..99a2b72 100644
--- a/web/plugins/views/painters.py
+++ b/web/plugins/views/painters.py
@@ -649,13 +649,17 @@ def paint_custom_notes(row):
files.reverse()
contents = []
def replace_tags(text):
+ sitename = row["site"]
+ site = html.site_status[sitename]["site"]
return text\
- .replace('$HOSTNAME$', host)\
+ .replace('$URL_PREFIX$', site["url_prefix"])\
+ .replace('$SITE$', sitename)\
+ .replace('$HOSTNAME$', host)\
.replace('$HOSTNAME_LOWER$', host.lower())\
.replace('$HOSTNAME_UPPER$', host.upper())\
.replace('$HOSTNAME_TITLE$', host[0].upper() + host[1:].lower())\
- .replace('$HOSTADDRESS$', row["host_address"])\
- .replace('$SERVICEDESC$', row.get("service_description",
""))
+ .replace('$HOSTADDRESS$', row["host_address"])\
+ .replace('$SERVICEDESC$', row.get("service_description",
""))
for f in files:
contents.append(replace_tags(unicode(file(f).read(),
"utf-8").strip()))
return "", "<hr>".join(contents)