From: Ondrej Lichtner olichtne@redhat.com
If define was a top level element (not a valid recipe) LNST would crash with a nonsensical error message. This fix skips removing the element and parsing should then fail because of schema validation.
Signed-off-by: Ondrej Lichtner olichtne@redhat.com --- lnst/Controller/XmlTemplates.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lnst/Controller/XmlTemplates.py b/lnst/Controller/XmlTemplates.py index a1541db..b1bf9a1 100644 --- a/lnst/Controller/XmlTemplates.py +++ b/lnst/Controller/XmlTemplates.py @@ -337,7 +337,8 @@ class XmlTemplates: value = etree.tostring(element, method="text").strip() self.define_alias(name, value) parent = element.getparent() - parent.remove(element) + if parent is not None: + parent.remove(element) return
self.add_namespace_level()
Thu, Nov 03, 2016 at 04:20:42PM CET, olichtne@redhat.com wrote:
From: Ondrej Lichtner olichtne@redhat.com
If define was a top level element (not a valid recipe) LNST would crash with a nonsensical error message. This fix skips removing the element and parsing should then fail because of schema validation.
Signed-off-by: Ondrej Lichtner olichtne@redhat.com
Reported-by: Jiri Pirko jiri@mellanox.com Tested-by: Jiri Pirko jiri@mellanox.com
lnst-developers@lists.fedorahosted.org