Module: check_mk
Branch: master
Commit: 0d034d6bed5dd860817276fe772648249d55ac96
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=0d034d6bed5dd8…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Apr 19 15:47:37 2012 +0200
FIX: Fixed login redirection problem after relogging
---
ChangeLog | 1 +
web/htdocs/login.py | 11 ++++++-----
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 37ebee1..156f9b4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,7 @@
are preferred over *.py if existing
* View Editor: Fixed jump to top of the page after moving painters during
editing views
+ * FIX: Fixed login redirection problem after relogging
Checks & Agents:
* FIX: Made logwatch parsing mechanism a little more robust
diff --git a/web/htdocs/login.py b/web/htdocs/login.py
index ba371f2..0d7b2d1 100644
--- a/web/htdocs/login.py
+++ b/web/htdocs/login.py
@@ -224,16 +224,17 @@ def normal_login_page(called_directly = True):
if not origtarget and not html.req.myfile == 'login':
origtarget = html.makeuri([])
+ # Never allow the login page to be opened in a frameset. Redirect top page to login page.
+ # This will result in a full screen login page.
+ html.javascript('''if(top != self) {
+ window.top.location.href = location;
+}''')
+
# When someone calls the login page directly and is already authed redirect to main page
if html.req.myfile == 'login' and check_auth() != '':
html.immediate_browser_redirect(0.5, origtarget and origtarget or 'index.py')
return
- # Never allow the login page to be opened in a frameset. Redirect top page to login page
- html.javascript('''if(top != self) {
- window.top.location.href = location;
-}''')
-
html.write("<div id=login>")
html.write("<img id=login_window src=\"images/login_window.png\">")
html.write("<div id=version>%s</div>" % defaults.check_mk_version)
Module: check_mk
Branch: master
Commit: 9101125a7588a34bb383c88b4fbf18e285dd4569
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9101125a7588a3…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Apr 18 12:29:07 2012 +0200
New hook for pre-distribution
---
web/htdocs/wato.py | 82 ++++++++++++++++++++++++++++++++++------------------
1 files changed, 54 insertions(+), 28 deletions(-)
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index a91f7a5..f9e0c8f 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -2792,13 +2792,24 @@ def mode_changelog(phase):
html.context_button(_("Site Configuration"), make_link([("mode", "sites")]), "sites")
elif phase == "action":
+
+ # Let host validators do their work
defective_hosts = validate_all_hosts([], force_all = True)
if defective_hosts:
raise MKUserError(None, _("You cannot activate changes while some hosts have "
"an invalid configuration: ") + ", ".join(
[ '<a href="%s">%s</a>' % (make_link([("mode", "edithost"), ("host", hn)]), hn)
for hn in defective_hosts.keys() ]))
-
+
+ # Give hooks chance to do some pre-activation things (and maybe stop
+ # the activation)
+ try:
+ call_hook_pre_distribute_changes()
+ except Exception, e:
+ if config.debug:
+ raise
+ else:
+ raise MKUserError(None, "<h3>%s</h3>%s" % (_("Cannot activate changes"), e))
sitestatus_do_async_replication = False # see below
if html.has_var("_siteaction"):
@@ -3381,7 +3392,14 @@ def check_mk_local_automation(command, args=[], indata=""):
(html.apache_user(), sudoline))
if command == 'restart':
- call_hook_pre_activate_changes()
+ try:
+ call_hook_pre_activate_changes()
+ except Exception, e:
+ if config.debug:
+ raise
+ html.show_error("<h3>Cannot activate changes</h3>%s" % e)
+ return
+
if config.debug:
log_audit(None, "automation", "Automation: %s" % " ".join(cmd))
@@ -10361,11 +10379,15 @@ def call_hooks(name, *args):
try:
hk(*args)
except Exception, e:
- import traceback, StringIO
- txt = StringIO.StringIO()
- t, v, tb = sys.exc_info()
- traceback.print_exception(t, v, tb, None, txt)
- html.show_error("<h3>" + _("Error executing hook") + " %s #%d: %s</h3><pre>%s</pre>" % (name, n, e, txt.getvalue()))
+ if config.debug:
+ import traceback, StringIO
+ txt = StringIO.StringIO()
+ t, v, tb = sys.exc_info()
+ traceback.print_exception(t, v, tb, None, txt)
+ html.show_error("<h3>" + _("Error executing hook") + " %s #%d: %s</h3><pre>%s</pre>" % (name, n, e, txt.getvalue()))
+ else:
+ raise
+
def call_hook_hosts_changed(folder):
if "hosts-changed" in g_hooks:
@@ -10385,32 +10407,36 @@ def call_hook_folder_deleted(folder):
if 'folder-deleted' in g_hooks:
call_hooks("folder-deleted", folder)
-def call_hook_pre_activate_changes():
- """
- This hook is executed when one applies the pending configuration changes
- from wato but BEFORE the nagios restart is executed.
-
- It can be used to create custom input files for nagios/Check_MK.
+# This hook is executed before distributing changes to the remote
+# sites (in distributed WATO) or before activating them (in single-site
+# WATO). If the hook raises an exception, then the distribution and
+# activation is aborted.
+def call_hook_pre_distribute_changes():
+ if hook_registered('pre-distribute-changes'):
+ call_hooks("pre-distribute-changes", collect_hosts(g_root_folder))
- The registered hooks are called with a dictionary as parameter which
- holds all available with the hostnames as keys and the attributes of
- the hosts as values.
- """
+# This hook is executed when one applies the pending configuration changes
+# from wato but BEFORE the nagios restart is executed.
+#
+# It can be used to create custom input files for nagios/Check_MK.
+#
+# The registered hooks are called with a dictionary as parameter which
+# holds all available with the hostnames as keys and the attributes of
+# the hosts as values.
+def call_hook_pre_activate_changes():
if hook_registered('pre-activate-changes'):
call_hooks("pre-activate-changes", collect_hosts(g_root_folder))
+# This hook is executed when one applies the pending configuration changes
+# from wato.
+#
+# But it is only excecuted when there is at least one function
+# registered for this host.
+#
+# The registered hooks are called with a dictionary as parameter which
+# holds all available with the hostnames as keys and the attributes of
+# the hosts as values.
def call_hook_activate_changes():
- """
- This hook is executed when one applies the pending configuration changes
- from wato.
-
- But it is only excecuted when there is at least one function
- registered for this host.
-
- The registered hooks are called with a dictionary as parameter which
- holds all available with the hostnames as keys and the attributes of
- the hosts as values.
- """
if hook_registered('activate-changes'):
call_hooks("activate-changes", collect_hosts(g_root_folder))