Module: check_mk
Branch: master
Commit: 8f103de51bdcc36f6184835360307df2b30aff93
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8f103de51bdcc3…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri May 25 11:53:52 2012 +0200
Broken plugins prevent plugin caching now
---
.bugs/681 | 8 ++++++--
ChangeLog | 1 +
web/htdocs/dashboard.py | 6 +++++-
web/htdocs/sidebar.py | 6 +++++-
web/htdocs/views.py | 6 +++++-
web/htdocs/wato.py | 6 +++++-
6 files changed, 27 insertions(+), 6 deletions(-)
diff --git a/.bugs/681 b/.bugs/681
index 70ff811..0ffe08c 100644
--- a/.bugs/681
+++ b/.bugs/681
@@ -1,10 +1,14 @@
Title: load_plugins should raise error if plugin is broken
Component: multisite
-State: open
+Class: nastiness
+State: done
Date: 2012-04-25 10:45:52
Targetversion: 1.2.0
-Class: nastiness
When loading plugins (e.g. WATO rule_specs), and there is a syntax
or other error in the plugin, an Exception should be raised.
Currently the plugin is silently ignored.
+
+2012-05-25 11:52:43: changed state open -> done
+Simply setting loaded_with_language AFTER plugin loading. Broken
+plugins will raise before reaching this code.
diff --git a/ChangeLog b/ChangeLog
index d2395f3..bcfb52b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -28,6 +28,7 @@
* New display type 'boxes-omit-root' for BI views
* Hostgroup view BI Boxes omits the root level
* Finalized layout if view options and commands/filters/painteroptions.
+ * Broken plugins prevent plugin caching now
* FIX: remove refresh button from dashboard.
* FIX: remove use of old option defaults.checkmk_web_uri
* FIX: fixed outgoing bandwidth in fc port perfometer
diff --git a/web/htdocs/dashboard.py b/web/htdocs/dashboard.py
index edbbabe..3129ca4 100644
--- a/web/htdocs/dashboard.py
+++ b/web/htdocs/dashboard.py
@@ -60,7 +60,6 @@ def load_plugins():
global loaded_with_language
if loaded_with_language == current_language:
return
- loaded_with_language = current_language
# Permissions are currently not being defined. That will be the
# case as soon as dashboards become editable.
@@ -70,6 +69,11 @@ def load_plugins():
# just may add custom dashboards by adding to builtin_dashboards.
load_web_plugins("dashboard", globals())
+ # This must be set after plugin loading to make broken plugins raise
+ # exceptions all the time and not only the first time (when the plugins
+ # are loaded).
+ loaded_with_language = current_language
+
# In future there will be user editable dashboards just like
# views which will be loaded. Currently we only use the builtin
# dashboads.
diff --git a/web/htdocs/sidebar.py b/web/htdocs/sidebar.py
index d37c239..c5c8502 100644
--- a/web/htdocs/sidebar.py
+++ b/web/htdocs/sidebar.py
@@ -39,13 +39,17 @@ def load_plugins():
global loaded_with_language
if loaded_with_language == current_language:
return
- loaded_with_language = current_language
# Load all snapins
global sidebar_snapins
sidebar_snapins = {}
load_web_plugins("sidebar", globals())
+ # This must be set after plugin loading to make broken plugins raise
+ # exceptions all the time and not only the first time (when the plugins
+ # are loaded).
+ loaded_with_language = current_language
+
# Declare permissions: each snapin creates one permission
config.declare_permission_section("sidesnap", _("Sidebar
snapins"))
for name, snapin in sidebar_snapins.items():
diff --git a/web/htdocs/views.py b/web/htdocs/views.py
index f1c189d..6647385 100644
--- a/web/htdocs/views.py
+++ b/web/htdocs/views.py
@@ -47,7 +47,6 @@ def load_plugins():
global loaded_with_language
if loaded_with_language == current_language:
return
- loaded_with_language = current_language
global multisite_datasources ; multisite_datasources = {}
global multisite_filters ; multisite_filters = {}
@@ -64,6 +63,11 @@ def load_plugins():
load_web_plugins("views", globals())
+ # This must be set after plugin loading to make broken plugins raise
+ # exceptions all the time and not only the first time (when the plugins
+ # are loaded).
+ loaded_with_language = current_language
+
# Declare permissions for builtin views
config.declare_permission_section("view", _("Builtin views"))
for name, view in multisite_builtin_views.items():
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 70e6c15..16dc0d0 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -11279,7 +11279,6 @@ def load_plugins():
global loaded_with_language
if loaded_with_language == current_language:
return
- loaded_with_language = current_language
# Reset global vars
global extra_buttons, configured_host_tags, host_attributes, user_attributes, \
@@ -11474,3 +11473,8 @@ def load_plugins():
load_web_plugins("wato", globals())
+
+ # This must be set after plugin loading to make broken plugins raise
+ # exceptions all the time and not only the first time (when the plugins
+ # are loaded).
+ loaded_with_language = current_language