]> git.ipfire.org Git - nitsi.git/commitdiff
Make class names camel-case
authorJonatan Schlag <jonatan.schlag@ipfire.org>
Sat, 9 Jun 2018 12:15:34 +0000 (14:15 +0200)
committerJonatan Schlag <jonatan.schlag@ipfire.org>
Sat, 9 Jun 2018 12:15:34 +0000 (14:15 +0200)
Fixes: #11718
Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
nitsi.in
src/nitsi/disk.py
src/nitsi/machine.py
src/nitsi/network.py
src/nitsi/recipe.py
src/nitsi/serial_connection.py
src/nitsi/test.py
src/nitsi/virtual_environ.py

index 55c7a7cefe297f707428586e149e58623c20508c..6bb5bb454ff2cd0927691872e98d07c0e9568308 100755 (executable)
--- a/nitsi.in
+++ b/nitsi.in
@@ -5,7 +5,7 @@ import logging
 
 from nitsi.logger import init_logging, Log_Formatter
 from nitsi.recipe import RecipeExeption
-from nitsi.test import TestException, test
+import nitsi.test
 
 logger = logging.getLogger("nitsi")
 
@@ -55,7 +55,7 @@ def main():
 
     # here we run a test
     try:
-        currenttest = test(args.dir, log_dir)
+        currenttest = nitsi.test.Test(args.dir, log_dir)
         currenttest.read_settings()
         currenttest.virtual_environ_setup()
         currenttest.load_recipe()
@@ -66,7 +66,7 @@ def main():
     try:
         currenttest.virtual_environ_start()
         currenttest.run_recipe()
-    except TestException as e:
+    except nitsi.test.TestException as e:
         logger.exception(e)
         return 1
     except BaseException as e:
index cec6a32d253b9653d5b23ce56373df8fbeeb8a80..9c3fd1da809d2a89ede5daefc6c9e4b893dd8051 100755 (executable)
@@ -9,7 +9,7 @@ import tempfile
 logger = logging.getLogger("nitsi.disk")
 
 
-class disk():
+class Disk():
     def __init__(self, disk):
         self.log = logger.getChild(os.path.basename(disk))
         self.log.debug("Initiated a disk class for {}".format(disk))
index 3e97ecff1bce985fd96a930a81984b34a870d1ab..0d3b14949a7cc57d3c5890bab171fb8f2fa59cc7 100644 (file)
@@ -10,7 +10,7 @@ from . import serial_connection
 
 logger = logging.getLogger("nitsi.machine")
 
-class machine():
+class Machine():
     def __init__(self, libvirt_con, vm_xml_file, snapshot_xml_file, image, root_uid, username, password):
         self.log = logger.getChild(os.path.basename(vm_xml_file))
         self.con = libvirt_con
@@ -47,7 +47,7 @@ class machine():
             self.log.error("No such file: {}".format(self.image))
 
         self.root_uid = root_uid
-        self.disk = disk.disk(image)
+        self.disk = disk.Disk(image)
 
         self.username = username
         self.password = password
@@ -128,7 +128,7 @@ class machine():
         return elem.text
 
     def check_is_booted_up(self):
-        serial_con = serial_connection.serial_connection(self.get_serial_device())
+        serial_con = serial_connection.Serial_connection(self.get_serial_device())
 
         serial_con.write("\n")
         # This will block till the domain is booted up
@@ -138,7 +138,7 @@ class machine():
 
     def login(self, log_file, log_start_time=None, longest_machine_name=10):
         try:
-            self.serial_con = serial_connection.serial_connection(self.get_serial_device(),
+            self.serial_con = serial_connection.Serial_connection(self.get_serial_device(),
                                 username=self.username,
                                 log_file=log_file,
                                 log_start_time=log_start_time,
index 7bdd0af86dcbd42b6191d4c0dc210e09b49e27e0..155cb3282d81bfdf5759e2a8d32d5c2fc703d782 100644 (file)
@@ -6,7 +6,7 @@ import os
 logger = logging.getLogger("nitsi.network")
 
 # # A class which define and undefine a virtual network based on an xml file
-class network():
+class Network():
     def __init__(self, libvirt_con, network_xml_file):
         self.log = logger.getChild(os.path.basename(os.path.dirname(network_xml_file)))
         self.con = libvirt_con
index f76066a96e1b2638727c1a8f2028780a058de58e..dc7bf60aa05964be527648dbaea2b57eee67a34b 100644 (file)
@@ -15,7 +15,7 @@ class RecipeExeption(Exception):
 
 # Should read the test, check if the syntax are valid
 # and return tuples with the ( host, command ) structure
-class recipe():
+class Recipe():
     def __init__(self, path, circle=[], machines=[]):
         self.recipe_file = path
         try:
@@ -107,7 +107,7 @@ class recipe():
                     self.log.error("Detect import loop!")
                     raise RecipeExeption("Detect import loop!")
                 self.circle.append(path)
-                recipe_to_include = recipe(path, circle=self.circle)
+                recipe_to_include = Recipe(path, circle=self.circle)
 
             if machine == "include":
                 self._recipe.extend(recipe_to_include.recipe)
index 3e65225b6ff7218c3715b57790b28a03dc92f72c..ca6ba62617659fdeb5d8435db3f08ae5ba90d285 100644 (file)
@@ -11,7 +11,7 @@ from . import logger
 
 log = logging.getLogger("nitsi.serial")
 
-class serial_connection():
+class Serial_connection():
     def __init__(self, device, username=None, log_file=None, name=None, log_start_time=None, longest_machine_name=10):
         self.buffer = b""
         self.back_at_prompt_pattern =  None
index 1b880d251b7c19587ceb5891a51f5750f7d48886..7f6b868fb815452b9e1fed16dd9224d66fe8af25 100755 (executable)
@@ -16,7 +16,7 @@ class TestException(Exception):
     def __init__(self, message):
         self.message = message
 
-class test():
+class Test():
     def __init__(self, path, log_path):
         try:
             self.path = os.path.abspath(path)
@@ -70,7 +70,7 @@ class test():
         self.virtual_environ_path = os.path.normpath(self.path + "/" + self.virtual_environ_path)
 
     def virtual_environ_setup(self):
-        self.virtual_environ = virtual_environ.virtual_environ(self.virtual_environ_path)
+        self.virtual_environ = virtual_environ.Virtual_environ(self.virtual_environ_path)
 
         self.virtual_networks = self.virtual_environ.get_networks()
 
@@ -103,7 +103,7 @@ class test():
     def load_recipe(self):
         self.log.info("Going to load the recipe")
         try:
-            self.recipe = recipe.recipe(self.recipe_file, machines=self.virtual_environ.machine_names)
+            self.recipe = recipe.Recipe(self.recipe_file, machines=self.virtual_environ.machine_names)
             for line in self.recipe.recipe:
                 self.log.debug(line)
 
index 3f7493300728f2a59489ddff92d8b17ffcb8ff82..2537b7d6273050a2f01ee171c6bf2da6eaaf58cd 100644 (file)
@@ -12,7 +12,7 @@ logger = logging.getLogger("nitsi.virtual_environ")
 
 # Should return all vms and networks in a list
 # and should provide the path to the necessary xml files
-class virtual_environ():
+class Virtual_environ():
     def __init__(self, path):
         self.log = logger.getChild(os.path.basename(os.path.abspath(path)))
         try:
@@ -62,14 +62,14 @@ class virtual_environ():
         networks = {}
         for _network in self.networks:
             self.log.debug(_network)
-            networks.setdefault(_network, network.network(self.con, os.path.normpath(self.path + "/" + self.config[_network]["xml_file"])))
+            networks.setdefault(_network, network.Network(self.con, os.path.normpath(self.path + "/" + self.config[_network]["xml_file"])))
         return networks
 
     def get_machines(self):
         machines = {}
         for _machine in self.machines:
             self.log.debug(_machine)
-            machines.setdefault(_machine, machine.machine(
+            machines.setdefault(_machine, machine.Machine(
                 self.con,
                 os.path.normpath(self.path + "/" + self.config[_machine]["xml_file"]),
                 os.path.normpath(self.path + "/" + self.config[_machine]["snapshot_xml_file"]),