From: Jonatan Schlag Date: Thu, 14 Jun 2018 07:12:55 +0000 (+0200) Subject: Allow including of recipe files X-Git-Url: http://git.ipfire.org/?p=nitsi.git;a=commitdiff_plain;h=c9c4a606d012438f0635b4058c1715a5a68f876d;hp=ee227ea12de1bbbdb31d37dbd5b12720d684afd3 Allow including of recipe files Signed-off-by: Jonatan Schlag --- diff --git a/src/nitsi/recipe.py b/src/nitsi/recipe.py index dc7bf60..e1e2af8 100644 --- a/src/nitsi/recipe.py +++ b/src/nitsi/recipe.py @@ -20,9 +20,10 @@ class Recipe(): self.recipe_file = path try: self.path = os.path.dirname(self.recipe_file) + self.path = os.path.abspath(self.path) self.name = os.path.basename(self.path) except BaseException as e: - logger.error("Failed to get the name of the test to this recipe") + logger.error("Failed to get the path to this recipe") raise e self.log = logger.getChild(self.name) @@ -102,7 +103,11 @@ class Recipe(): if machine == "include": path = cmd.strip() path = os.path.normpath(self.path + "/" + path) - path = path + "/recipe" + + # If we did not get a valid file we asume that we get a valid path to a test. + if os.path.isdir(path): + path = path + "/recipe" + if path in self.circle: self.log.error("Detect import loop!") raise RecipeExeption("Detect import loop!")