[PATCH] [Wok] Issue #12:wokd start fails if plugin does not have ui/config/tab-ext.xml

From: Archana Singh <archus@linux.vnet.ibm.com> Currently the tab-ext.xml are read and parse for each plugin in side for loop. Moved code which parse of 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@linux.vnet.ibm.com> --- src/wok/utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/wok/utils.py b/src/wok/utils.py index 997adf3..1c997e3 100644 --- a/src/wok/utils.py +++ b/src/wok/utils.py @@ -109,7 +109,10 @@ def get_all_tabs(): tabs = [] for f in files: - root = ET.parse(f) + try: + root = ET.parse(f) + except (IOError), e: + continue tabs.extend([t.text.lower() for t in root.getiterator('title')]) return tabs -- 2.1.0

Would only suggest add a log msg like "Unable to load %(f)s for enable plugin %(plugin)s" in addition to the continue command. With something like this, we can understand that there's no UI tab-ext.xml file for an enable plugin. Anyway, the patch is good. Reviewed-by: Paulo Vital <pvital@linux.vnet.ibm.com> On 12/21/2015 04:38 AM, archus@linux.vnet.ibm.com wrote:
From: Archana Singh <archus@linux.vnet.ibm.com>
Currently the tab-ext.xml are read and parse for each plugin in side for loop. Moved code which parse of 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@linux.vnet.ibm.com> --- src/wok/utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/wok/utils.py b/src/wok/utils.py index 997adf3..1c997e3 100644 --- a/src/wok/utils.py +++ b/src/wok/utils.py @@ -109,7 +109,10 @@ def get_all_tabs():
tabs = [] for f in files: - root = ET.parse(f) + try: + root = ET.parse(f) + except (IOError), e: + continue tabs.extend([t.text.lower() for t in root.getiterator('title')])
return tabs
participants (2)
-
archus@linux.vnet.ibm.com
-
Paulo Vital