Module: check_mk
Branch: master
Commit: b814b62fc038ecddc32c92d17b1a8a515ad09f94
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b814b62fc038ec…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Jan 3 09:11:10 2013 +0100
FIX: Fixed rendering bug after folder editing
(The references from parent to child folders are updated during load_folders now)
---
ChangeLog | 1 +
web/htdocs/wato.py | 12 ++++++++++--
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 4a3e760..cc6312e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -74,6 +74,7 @@
* FIX: Fixed generated manual check definitions for checks without items
like ntp_time and tcp_conn_stats
* FIX: Persisting changing of folder titles when only the title has changed
+ * FIX: Fixed rendering bug after folder editing
* Add: Creating a new rule immediately opens its edit formular
* The rules formular now uses POST as transaction method
* Modularized the authentication and user management code
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 95d7236..5f5b2a8 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -469,8 +469,12 @@ def load_folder(dir, name="", path="", parent=None, childs = True):
folder[".lock_subfolders"] = folder.get("lock_subfolders", False)
folder[".lock_hosts"] = False
if parent:
+ # Update reference to parent folder
folder[".parent"] = parent
+ # Update reference in parent folder
+ parent[".folders"][name] = folder
+
if "attributes" not in folder: # Make sure, attributes are always present
folder["attributes"] = {}
@@ -952,14 +956,14 @@ def mode_folder(phase):
lock_messages.append(_("Folder is locked (You cannot create or remove folders in this folder)"))
else:
lock_messages.append(g_folder[".lock_subfolders"])
-
+
if len(lock_messages) > 0:
lock_message = ", ".join(lock_messages)
html.write("<div class=info>" + lock_message + "</div>")
have_something = show_subfolders(g_folder)
# Show hosts only if we have permission to this folder
-
+
if True == check_folder_permissions(g_folder, "read", False):
have_something = show_hosts(g_folder) or have_something
if not have_something:
@@ -1440,6 +1444,8 @@ def show_hosts(folder):
return True
move_to_folder_combo_cache_id = None
+# In case of what == "host", thing is either None or the name of the host
+# In case of what == "folder", thing is the folder dict
def move_to_folder_combo(what, thing = None, top = False, multiple = False):
global move_to_folder_combo_cache, move_to_folder_combo_cache_id
if move_to_folder_combo_cache_id != id(html):
@@ -1458,6 +1464,7 @@ def move_to_folder_combo(what, thing = None, top = False, multiple = False):
# TODO: Check permisssions
if afolder != g_folder and \
(what != "folder" or not (
+ # no move to itselfs or child folders of "thing"
folder_is_parent_of(thing, afolder)
# avoid naming conflict!
or thing[".name"] in afolder[".folders"])):
@@ -1757,6 +1764,7 @@ def mode_editfolder(phase, new):
# in Nagios-relevant attributes.
rewrite_config_files_below(g_folder) # due to inherited attributes
save_folder(g_folder)
+ # This updats g_folder and g_folders[...]
g_folder = reload_folder(g_folder)
mark_affected_sites_dirty(g_folder)
Module: check_mk
Branch: master
Commit: b928b7108608531bc871eb07ced79347a3e1862a
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b928b710860853…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Jan 2 10:59:06 2013 +0100
ldap: More detailed exception text in case of connection errors
---
web/plugins/userdb/ldap.py | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/web/plugins/userdb/ldap.py b/web/plugins/userdb/ldap.py
index 7c57aec..5d7b6fa 100644
--- a/web/plugins/userdb/ldap.py
+++ b/web/plugins/userdb/ldap.py
@@ -141,9 +141,10 @@ def ldap_connect():
# on success, store the connection options the connection has been made with
ldap_connection_options = config.ldap_connection
- except ldap.SERVER_DOWN:
+ except ldap.SERVER_DOWN, e:
+ msg = e[0].get('info', e[0].get('desc', ''))
ldap_connection = None # Invalidate connection on failure
- raise MKLDAPException(_('The LDAP connector is unable to connect to the LDAP server.'))
+ raise MKLDAPException(_('The LDAP connector is unable to connect to the LDAP server (%s).') % msg)
except ldap.LDAPError, e:
html.write(repr(e))