]> git.ipfire.org Git - nitsi.git/blobdiff - test.py
Add new test and improve our example test to show our new possibilities
[nitsi.git] / test.py
diff --git a/test.py b/test.py
index 67f824e1f4411fd883979e22fc68938eb0384cb9..c2d62ce9412efd9c99e8b60f8bd337fed0c9853a 100755 (executable)
--- a/test.py
+++ b/test.py
@@ -20,34 +20,6 @@ class log():
     def error(self, string):
         print("ERROR: {}".format(string))
 
-class libvirt_con():
-    def __init__(self, uri):
-        self.log = log(4)
-        self.uri = uri
-        self.connection = None
-
-    def get_domain_from_name(self, name):
-        dom = self.con.lookupByName(name)
-
-        if dom == None:
-            raise BaseException
-        return dom
-
-    @property
-    def con(self):
-        if self.connection == None:
-            try:
-                self.connection = libvirt.open(self.uri)
-            except BaseException as error:
-                self.log.error("Could not connect to: {}".format(self.uri))
-
-            self.log.debug("Connected to: {}".format(self.uri))
-            return self.connection
-
-        return self.connection
-
-
-
 class test():
     def __init__(self, path):
         self.log = log(4)
@@ -112,9 +84,11 @@ class test():
     def load_recipe(self):
         try:
             self.recipe = recipe(self.recipe_file)
-        except BaseException:
+            for line in self.recipe.recipe:
+                self.log.debug(line)
+        except BaseException as e:
             self.log.error("Failed to load recipe")
-            exit(1)
+            raise e
 
     def run_recipe(self):
         for line in self.recipe.recipe: