Repository: cobbler/cobbler

Issue:
Logging in setup.py
### Describe the bug

At the moment we are using a custom logger. This is wrong because this is not adding to the log from the build.

### Steps to reproduce

1. `make install`

### Expected behavior

The log should show the custom log messages we added.

### Cobbler version

<!--- Paste output from `cobbler version` -->
````paste below
main
````

### Operating system

openSUSE Leap

### Cobbler log

<!--- Paste (partial) output from `/var/log/cobbler/cobbler.log` -->
````paste below
````

### Screenshots

Not applicabel

### Additional information

Discovered while working on #3004



Discussion:

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -3,7 +3,6 @@
 import os
 import sys
 import time
-import logging
 import glob as _glob
 
 from setuptools import setup
@@ -27,8 +26,6 @@
 VERSION = "3.4.0"
 OUTPUT_DIR = "config"
 
-log = logging.getLogger("setup.py")
-
 # # Configurable installation roots for various data files.
 datadir = os.environ.get("DATAPATH", "/usr/share/cobbler")
 docpath = os.environ.get("DOCPATH", "share/man")
@@ -292,7 +289,7 @@ def run(self):
                 self.configure_one_file(infile, outfile)
 
     def configure_one_file(self, infile, outfile):
-        log.info("configuring %s" % infile)
+        self.announce("configuring %s" % infile, 3)
         if not self.dry_run:
             # Read the file
             with codecs.open(infile, "r", "utf-8") as fh:
@@ -347,7 +344,7 @@ def __init__(self, *args):
     def change_owner(self, path, owner):
         user = pwd.getpwnam(owner)
         try:
-            log.info("changing mode of %s" % path)
+            self.announce("changing mode of %s" % path, 3)
             if not self.dry_run:
                 # os.walk does not include the toplevel directory
                 os.lchown(path, user.pw_uid, -1)
@@ -425,14 +422,14 @@ def finalize_options(self):
     def _copy(self, frm, to):
         if os.path.isdir(frm):
             to = os.path.join(to, os.path.basename(frm))
-            log.debug("copying %s/ to %s/" % (frm, to))
+            self.announce("copying %s/ to %s/" % (frm, to), 3)
             if not self.dry_run:
                 if os.path.exists(to):
                     shutil.rmtree(to)
                 shutil.copytree(frm, to)
         else:
-            log.debug(
-                "copying %s to %s" % (frm, os.path.join(to, os.path.basename(frm)))
+            self.announce(
+                "copying %s to %s" % (frm, os.path.join(to, os.path.basename(frm))), 3
             )
             if not self.dry_run:
                 shutil.copy2(frm, to)
@@ -450,7 +447,7 @@ def _copy(self, frm, to):
         statebase._copy(self, frm, to)
 
     def run(self):
-        log.info("restoring the current configuration from %s" % self.statepath)
+        self.announce("restoring the current configuration from %s" % self.statepath, 3)
         if not os.path.exists(self.statepath):
             self.warn("%s does not exist. Skipping" % self.statepath)
             return
@@ -480,9 +477,9 @@ def _copy(self, frm, to):
         statebase._copy(self, frm, to)
 
     def run(self):
-        log.info("backing up the current configuration to %s" % self.statepath)
+        self.announce("backing up the current configuration to %s" % self.statepath, 3)
         if os.path.exists(self.statepath):
-            log.debug("deleting existing %s" % self.statepath)
+            self.announce("deleting existing %s" % self.statepath, 3)
             if not self.dry_run:
                 shutil.rmtree(self.statepath)
         if not self.dry_run:
@@ -569,6 +566,7 @@ def run(self):
             "grub_mod_folder": grub_mod_folder,
         },
         configure_files=[
+            "cobbler/settings/migrations/V3_3_0.py",
             "cobbler/settings/migrations/V3_3_1.py",
             "config/apache/cobbler.conf",
             "config/cobbler/settings.yaml",


Test patch: