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 55c7a7c..6bb5bb4 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 cec6a32..9c3fd1d 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 3e97ecf..0d3b149 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 7bdd0af..155cb32 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 f76066a..dc7bf60 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 3e65225..ca6ba62 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 1b880d2..7f6b868 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 3f74933..2537b7d 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"]),