]> git.ipfire.org Git - nitsi.git/commitdiff
Improve recipe parsing
authorJonatan Schlag <jonatan.schlag@ipfire.org>
Wed, 6 Jun 2018 13:24:54 +0000 (15:24 +0200)
committerJonatan Schlag <jonatan.schlag@ipfire.org>
Wed, 6 Jun 2018 13:24:54 +0000 (15:24 +0200)
We now allow empty lines and comments.

Fixes: #11746
Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
src/nitsi/recipe.py

index 7872aa332e593ccda9fdebf54eeeb59b93a0d1d3..7d27ca4fd41d82d99a2152084beb939898e10e37 100644 (file)
@@ -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))