commit 1fb8afc1721ac25fa34492c0768da747e77b26b8
Author: Radek Pazdera <rpazdera(a)redhat.com>
Date: Fri Sep 6 12:46:41 2013 +0200
RecipeParser: Fixing the Comments Bug
The previous fix of the bug with comments proved ineffective (there are
problems with the comment tags on multiple places). This patch reverts
the previous change and adds a simple preprocessing of the element tree
to remove all comments before it is processed.
Signed-off-by: Radek Pazdera <rpazdera(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
lnst/Controller/RecipeParser.py | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/lnst/Controller/RecipeParser.py b/lnst/Controller/RecipeParser.py
index 9311b4a..2bd6c38 100644
--- a/lnst/Controller/RecipeParser.py
+++ b/lnst/Controller/RecipeParser.py
@@ -34,6 +34,13 @@ class RecipeParser(XmlParser):
def _process(self, lnst_recipe):
recipe = XmlData(lnst_recipe)
+ # remove all comments from the document
+ comments = lnst_recipe.xpath('//comment()')
+ for c in comments:
+ p = c.getparent()
+ if p is not None:
+ p.remove(c)
+
# machines
machines_tag = lnst_recipe.find("machines")
if machines_tag is not None:
@@ -158,10 +165,6 @@ class RecipeParser(XmlParser):
if len(task_tag) > 0:
task["commands"] = XmlCollection(task_tag)
for cmd_tag in task_tag:
- # Ignore comments
- if cmd_tag.tag is etree.Comment:
- continue
-
if cmd_tag.tag == "run":
cmd = self._process_run_cmd(cmd_tag)
elif cmd_tag.tag == "config":
Show replies by date