[elbe-devel] [PATCH 1/8] elbepack: soapclient: remove global logging configuration

Thomas Weißschuh thomas.weissschuh at linutronix.de
Fri Aug 9 14:47:16 CEST 2024


Avoid messing with the global logging cofiguration from a normal object
constructor, as it's unpredictable.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
 elbepack/config.py     |  7 -------
 elbepack/soapclient.py | 22 ++--------------------
 2 files changed, 2 insertions(+), 27 deletions(-)

diff --git a/elbepack/config.py b/elbepack/config.py
index a51ac65f288d..6503a0552300 100644
--- a/elbepack/config.py
+++ b/elbepack/config.py
@@ -54,13 +54,6 @@ def add_arguments_soapclient(parser):
         help='How many times to retry the connection to the server before '
              'giving up (default is 10 times, yielding 10 seconds).')
 
-    devel = parser.add_argument_group(
-        'options for elbe developers',
-        "Caution: Don't use these options in a productive environment")
-    devel.add_argument('--debug', action='store_true',
-                       dest='debug', default=False,
-                       help='Enable debug mode.')
-
 
 def add_argument_sshport(parser_or_func):
     return add_argument_to_parser_or_function(
diff --git a/elbepack/soapclient.py b/elbepack/soapclient.py
index dd1d574fdc07..44df2e6d7102 100644
--- a/elbepack/soapclient.py
+++ b/elbepack/soapclient.py
@@ -35,26 +35,8 @@ class ElbeVersionMismatch(RuntimeError):
             raise cls(client_version, server_version)
 
 
-def set_suds_debug(debug):
-    if debug:
-        logging.basicConfig(level=logging.INFO)
-        logging.getLogger('suds.client').setLevel(logging.DEBUG)
-        logging.getLogger('suds.transport').setLevel(logging.DEBUG)
-        logging.getLogger('suds.xsd.schema').setLevel(logging.DEBUG)
-        logging.getLogger('suds.wsdl').setLevel(logging.DEBUG)
-        logging.getLogger('suds.resolver').setLevel(logging.DEBUG)
-        logging.getLogger('suds.umx.typed').setLevel(logging.DEBUG)
-    else:
-        logging.basicConfig(level=logging.CRITICAL)
-        logging.getLogger('suds.umx.typed').setLevel(logging.ERROR)
-        logging.getLogger('suds.client').setLevel(logging.CRITICAL)
-
-
 class ElbeSoapClient:
-    def __init__(self, host, port, user, passwd, timeout, retries=10, debug=False):
-
-        # Mess with suds logging, for debug, or squelch warnings
-        set_suds_debug(debug)
+    def __init__(self, host, port, user, passwd, timeout, retries=10):
 
         # Attributes
         self._wsdl = 'http://' + host + ':' + str(port) + '/soap/?wsdl'
@@ -89,7 +71,7 @@ class ElbeSoapClient:
     @classmethod
     def from_args(cls, args):
         return cls(args.soaphost, args.soapport, args.soapuser, args.soappassword,
-                   args.soaptimeout, debug=args.debug, retries=args.retries)
+                   args.soaptimeout, retries=args.retries)
 
     def download_file(self, builddir, filename, dst_fname):
         fp = open(dst_fname, 'wb')

-- 
2.46.0



More information about the elbe-devel mailing list