The parser wraps exceptions that go through his handler hooks to his
own
exception class called XmlProcessingError to add information about
at which line of the XML file the problem happened.
Doing this however results in discarding the original traceback, which
is replaced by different one that leads to the try/catch block. This
is not helpful at all. It actually makes debugging extremelly irritating.
This patch changes this behaviour so the parser only logs an error with
the line information and it re-raises the original exeption with the
original traceback.
Signed-off-by: Radek Pazdera <rpazdera(a)redhat.com>
---
lnst/Controller/NetTestParse.py | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/lnst/Controller/NetTestParse.py b/lnst/Controller/NetTestParse.py
index 39d23bd..d3e9bbc 100644
--- a/lnst/Controller/NetTestParse.py
+++ b/lnst/Controller/NetTestParse.py
@@ -39,10 +39,7 @@ class NetTestParse(RecipeParser):
first_pass = FirstPass(self)
first_pass.parse(xml_dom)
- try:
- self._trigger_event("provisioning_requirements_ready", {})
- except Exception as exc:
- raise XmlProcessingError(str(exc), xml_dom)
+ self._trigger_event("provisioning_requirements_ready", {})
second_pass = SecondPass(self)
second_pass.parse(xml_dom)
@@ -180,7 +177,8 @@ class MachineParse(RecipeParser):
try:
self._trigger_event("machine_ready", {"machine_id":
self._id})
except Exception as exc:
- raise XmlProcessingError(str(exc), node)
+ logging.error(XmlProcessingError(str(exc), xml_dom))
+ raise
class ParamsParse(RecipeParser):
_params = None
@@ -337,7 +335,8 @@ class SlaveMachineParse(RecipeParser):
self._trigger_event("netdevice_ready",
{"machine_id": self._machine_id, "dev_id":
phys_id})
except Exception as exc:
- raise XmlProcessingError(str(exc), node)
+ logging.error(XmlProcessingError(str(exc), xml_dom))
+ raise
class NetConfigParse(RecipeParser):
_machine_id = None
@@ -393,7 +392,8 @@ class NetConfigParse(RecipeParser):
except Exception as exc:
msg = "Unable to configure interface %s on machine %s [%s]." % \
(dev_id, self._machine_id, str(exc))
- raise XmlProcessingError(msg, node)
+ logging.error(XmlProcessingError(str(msg), xml_dom))
+ raise
def _process_phys_id_attr(self, node, dev):
netconfig = self._netconfig
--
1.7.7.6
_______________________________________________
LNST-developers mailing list
LNST-developers(a)lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/lnst-developers
applied. Thanks Radek