From 51cbe8da7c00e86f10b8e6b6807e6708dd95e1b9 Mon Sep 17 00:00:00 2001 From: Jiri Hnidek Date: Mon, 1 Jul 2024 11:33:34 +0200 Subject: [PATCH] fix: Replace all warn() with warning() * The warn() has been deprecated for very long time and it just become not available in the newest version of Python 3.13 https://docs.python.org/3.13/whatsnew/3.13.html#logging --- virtwho/config.py | 10 +++++----- virtwho/manager/satellite/satellite.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/virtwho/config.py b/virtwho/config.py index 602e0da8..dd07d7a9 100644 --- a/virtwho/config.py +++ b/virtwho/config.py @@ -402,7 +402,7 @@ def parse_file(filename): except InvalidOption as e: # When a configuration section has an Invalid Option, continue # See https://bugzilla.redhat.com/show_bug.cgi?id=1457101 for more info - logger.warn("Invalid configuration detected: %s", str(e)) + logger.warning("Invalid configuration detected: %s", str(e)) except DuplicateOptionError as e: logger.warning(str(e)) except Exception as e: @@ -1342,14 +1342,14 @@ def all_drop_dir_config_sections(config_dir=VW_CONF_DIR): conf_files = set(s for s in all_dir_content if s.endswith('.conf')) non_conf_files = all_dir_content - conf_files except OSError: - logger.warn("Configuration directory '%s' doesn't exist or is not accessible", + logger.warning("Configuration directory '%s' doesn't exist or is not accessible", config_dir) return {} if not all_dir_content: - logger.warn("Configuration directory '%s' appears empty", config_dir) + logger.warning("Configuration directory '%s' appears empty", config_dir) elif not conf_files: - logger.warn("Configuration directory '%s' does not have any '*.conf' files but " + logger.warning("Configuration directory '%s' does not have any '*.conf' files but " "is not empty", config_dir) elif non_conf_files: logger.debug("There are files in '%s' not ending in '*.conf' is this " @@ -1372,7 +1372,7 @@ def has_config_files_in_drop_dir(config_dir=VW_CONF_DIR): all_dir_content = set(os.listdir(config_dir)) conf_files = set(s for s in all_dir_content if s.endswith('.conf')) except OSError: - logger.warn("Configuration directory '%s' doesn't exist or is not accessible", + logger.warning("Configuration directory '%s' doesn't exist or is not accessible", config_dir) return False diff --git a/virtwho/manager/satellite/satellite.py b/virtwho/manager/satellite/satellite.py index 5fe5fb87..8fd7192a 100644 --- a/virtwho/manager/satellite/satellite.py +++ b/virtwho/manager/satellite/satellite.py @@ -238,7 +238,7 @@ def hypervisorCheckIn(self, report, options=None): self.server_xmlrpc.registration.virt_notify(hypervisor_systemid["system_id"], plan) except xmlrpc.client.Fault as e: if e.faultCode == -9: - self.logger.warn("System was deleted from Satellite 5, reregistering") + self.logger.warning("System was deleted from Satellite 5, re-registering") hypervisor_systemid = self._load_hypervisor(hypervisor.hypervisorId, hypervisor_type=report.config['type'], force=True) self.server_xmlrpc.registration.virt_notify(hypervisor_systemid["system_id"], plan)