From: Archana Singh <archus(a)linux.vnet.ibm.com>
Added support for plugins without tab-ext.xml.
1) While parsing installed plugin tab-ext.xml,
handled IOError(File not found).
2)If retrieved tabs for UI in js,
is not empty then only add to tabs.
Archana Singh (2):
Issue #12: wokd start fails if plugin does not have
ui/config/tab-ext.xml
Issue #12: wokd start fails if plugin does not have
ui/config/tab-ext.xml
src/wok/utils.py | 6 +++++-
ui/js/src/wok.main.js | 10 ++++++----
2 files changed, 11 insertions(+), 5 deletions(-)
--
2.1.0
Show replies by date
From: Archana Singh <archus(a)linux.vnet.ibm.com>
Currently, it gets the list of tab-ext.xml
for all the installed plugins and then
each file is parsed in for loop.
Moved code which parse the tab-ext.xml file
inside try except block to handle IOError.
On IOError(File not found) continue the for
loop to parse other plugins tab-ext.xml.
Signed-off-by: Archana Singh <archus(a)linux.vnet.ibm.com>
---
src/wok/utils.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/wok/utils.py b/src/wok/utils.py
index 997adf3..7b1b309 100644
--- a/src/wok/utils.py
+++ b/src/wok/utils.py
@@ -109,7 +109,11 @@ def get_all_tabs():
tabs = []
for f in files:
- root = ET.parse(f)
+ try:
+ root = ET.parse(f)
+ except (IOError):
+ wok_log.debug("Unable to load %s", f)
+ continue
tabs.extend([t.text.lower() for t in root.getiterator('title')])
return tabs
--
2.1.0
From: Archana Singh <archus(a)linux.vnet.ibm.com>
retrieveTabs returns empty list if any installed
plugin does not have tab-ext.xml, so pluginTabs[0]
becomes undefine.
So added if length of pluginTabs is greater
than zero than push the pluginsTabs into tabs.
Signed-off-by: Archana Singh <archus(a)linux.vnet.ibm.com>
---
ui/js/src/wok.main.js | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/ui/js/src/wok.main.js b/ui/js/src/wok.main.js
index 3df6fee..2a41bc5 100644
--- a/ui/js/src/wok.main.js
+++ b/ui/js/src/wok.main.js
@@ -125,11 +125,13 @@ wok.main = function() {
function(i18nObj){ //i18n is not define by plugin
}, i18nUrl, true);
var pluginTabs = retrieveTabs(url);
- var func = pluginTabs[0].functionality
- if (functionalTabs.indexOf(func) == -1) {
- functionalTabs.push(pluginTabs[0].functionality)
+ if(pluginTabs.length > 0){
+ var func = pluginTabs[0].functionality
+ if (functionalTabs.indexOf(func) == -1) {
+ functionalTabs.push(pluginTabs[0].functionality)
+ }
+ tabs.push.apply(tabs, pluginTabs);
}
- tabs.push.apply(tabs, pluginTabs);
});
//redirect to empty page when no plugin installed
--
2.1.0
Applied. Thanks.
Regards,
Aline Manera