If the plugin tab name string is not found in kimchi i18n file, the
tab name is set as 'unknown'. This patch also add more messages to
kimchis log, and fixes a problem with the plugins extra tabs file
location
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo(a)linux.vnet.ibm.com>
---
src/kimchi/server.py | 13 ++++++++++---
ui/js/src/kimchi.main.js | 2 +-
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/src/kimchi/server.py b/src/kimchi/server.py
index b820263..4fcb0df 100644
--- a/src/kimchi/server.py
+++ b/src/kimchi/server.py
@@ -28,6 +28,7 @@ import logging.handlers
import os
import sslcert
+
from kimchi import auth
from kimchi import config
from kimchi import model
@@ -208,14 +209,19 @@ class Server(object):
script_name = plugin_config['kimchi']['uri']
del plugin_config['kimchi']
+ tabs_extra_file = config.get_plugin_tab_xml(plugin_name)
plugin_config['/ui/config/tab-ext.xml'] = {
'tools.staticfile.on': True,
- 'tools.staticfile.filename':
- config.get_plugin_tab_xml(plugin_name),
+ 'tools.staticfile.filename': tabs_extra_file,
'tools.nocache.on': True}
except KeyError:
continue
-
+ except IOError as e:
+ msg = "Failed to load plugin tabs file %s" %tabs_extra_file
+ cherrypy.log.error_log.error(msg)
+ cherrypy.log.error_log.error('Ignoring plugin "%s"',
+ plugin_name)
+ continue
try:
plugin_app = import_class(plugin_class)()
except ImportError:
@@ -223,6 +229,7 @@ class Server(object):
plugin_class)
continue
cherrypy.tree.mount(plugin_app, script_name, plugin_config)
+ cherrypy.log('Plugin loaded: %s' %plugin_class)
def _init_ssl(self, options):
ssl_server = cherrypy._cpserver.Server()
diff --git a/ui/js/src/kimchi.main.js b/ui/js/src/kimchi.main.js
index cc8afee..8b84a34 100644
--- a/ui/js/src/kimchi.main.js
+++ b/ui/js/src/kimchi.main.js
@@ -211,7 +211,7 @@ kimchi.getTabHtml = function(url) {
$(xmlData).find('tab').each(function() {
var $tab = $(this);
var titleKey = $tab.find('title').text();
- var title = i18n[titleKey];
+ var title = i18n[titleKey] || titleKey;
var path = $tab.find('path').text();
tabsHtml += "<li><a class='item' href=" + path
+ ">" + title + "</a></li>";
});
--
1.8.4.2