From: Jonatan Schlag Date: Wed, 6 Jun 2018 13:24:54 +0000 (+0200) Subject: Improve recipe parsing X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6cb7e93928ecfda785a5a3fa04b7b0099dabf4fd;p=nitsi.git Improve recipe parsing We now allow empty lines and comments. Fixes: #11746 Signed-off-by: Jonatan Schlag --- 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))