[PATCH V2] [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, 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@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..0138bd2 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), e: + 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

Reviewed-by: Paulo Vital <pvital@linux.vnet.ibm.com> On 12/21/2015 10:09 AM, archus@linux.vnet.ibm.com wrote:
From: Archana Singh <archus@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@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..0138bd2 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), e: + wok_log.debug("Unable to load %s", f) + continue tabs.extend([t.text.lower() for t in root.getiterator('title')])
return tabs

make check-local is failing with this patch: [alinefm@alinefm-TP440 wok]$ sudo make check-local [sudo] password for alinefm: PYTHONPATH=src contrib/check_i18n.py src/wok/plugins/*/i18n.py src/wok/i18n.py Checking for invalid i18n string... Checking for invalid i18n string successfully find . -path './.git' -prune -type f -o \ -name '*.py' -o -name '*.py.in' | xargs /bin/pyflakes | \ grep -w -v "\./src/wok/websocket\.py" | \ while read LINE; do echo "$LINE"; false; done ./src/wok/utils.py:114: local variable 'e' is assigned to but never used Makefile:930: recipe for target 'check-local' failed make: *** [check-local] Error 1 On 12/21/2015 10:09 AM, archus@linux.vnet.ibm.com wrote:
From: Archana Singh <archus@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@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..0138bd2 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), e: + wok_log.debug("Unable to load %s", f) + continue tabs.extend([t.text.lower() for t in root.getiterator('title')])
return tabs
participants (3)
-
Aline Manera
-
archus@linux.vnet.ibm.com
-
Paulo Vital