From 6cb7e93928ecfda785a5a3fa04b7b0099dabf4fd Mon Sep 17 00:00:00 2001 From: Jonatan Schlag Date: Wed, 6 Jun 2018 15:24:54 +0200 Subject: [PATCH] Improve recipe parsing We now allow empty lines and comments. Fixes: #11746 Signed-off-by: Jonatan Schlag --- src/nitsi/recipe.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/nitsi/recipe.py b/src/nitsi/recipe.py index 7872aa3..7d27ca4 100644 --- a/src/nitsi/recipe.py +++ b/src/nitsi/recipe.py @@ -69,6 +69,18 @@ class recipe(): self._recipe = [] i = 1 for line in self.raw_recipe: + # Check if the line is empty + if line.strip() == "": + self.log.debug("Skipping empty line {}".format(i)) + i = i + 1 + continue + + # Check if the line is a comment + if line.strip().startswith("#"): + self.log.debug("Skipping comment in line {}".format(i)) + i = i + 1 + continue + raw_line = line.split(":", 1) if len(raw_line) < 2: self.log.error("Error parsing the recipe in line {}".format(i)) -- 2.47.3