Description: Replace deprecated logging function Author: Valentin Vidic Last-Update: 2022-05-01 --- This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ --- a/agents/aliyun/fence_aliyun.py +++ b/agents/aliyun/fence_aliyun.py @@ -15,7 +15,7 @@ from aliyunsdkcore.auth.credentials import EcsRamRoleCredential from aliyunsdkcore.profile import region_provider except ImportError as e: - logging.warn("The 'aliyunsdkcore' module has been not installed or is unavailable, try to execute the command 'pip install aliyun-python-sdk-core --upgrade' to solve. error: %s" % e) + logging.warning("The 'aliyunsdkcore' module has been not installed or is unavailable, try to execute the command 'pip install aliyun-python-sdk-core --upgrade' to solve. error: %s" % e) try: @@ -24,7 +24,7 @@ from aliyunsdkecs.request.v20140526.StopInstanceRequest import StopInstanceRequest from aliyunsdkecs.request.v20140526.RebootInstanceRequest import RebootInstanceRequest except ImportError as e: - logging.warn("The 'aliyunsdkecs' module has been not installed or is unavailable, try to execute the command 'pip install aliyun-python-sdk-ecs --upgrade' to solve. error: %s" % e) + logging.warning("The 'aliyunsdkecs' module has been not installed or is unavailable, try to execute the command 'pip install aliyun-python-sdk-ecs --upgrade' to solve. error: %s" % e) def _send_request(conn, request): @@ -182,7 +182,7 @@ try: region_provider.modify_point('Ecs', region, 'ecs.%s.aliyuncs.com' % region) except Exception as e: - logging.warn("Failed: failed to modify endpoint to 'ecs.%s.aliyuncs.com': %s" % (region, e)) + logging.warning("Failed: failed to modify endpoint to 'ecs.%s.aliyuncs.com': %s" % (region, e)) # Operate the fencing device result = fence_action(conn, options, set_power_status, get_power_status, get_nodes_list) --- a/agents/compute/fence_compute.py +++ b/agents/compute/fence_compute.py @@ -98,7 +98,7 @@ # Since it's about forcing back to a default value, there is # no real worries to just consider it's still okay even if the # command failed - logging.warn("Exception from attempt to force " + logging.warning("Exception from attempt to force " "host back up via nova API: " "%s: %s" % (e.__class__.__name__, e)) --- a/agents/sbd/fence_sbd.py +++ b/agents/sbd/fence_sbd.py @@ -170,7 +170,7 @@ if "msgwait" in line: tmp_msg_timeout = int(line.split(':')[1]) if -1 != msg_timeout and tmp_msg_timeout != msg_timeout: - logging.warn(\ + logging.warning(\ "sbd message timeouts differ in different devices") # we only save the highest timeout if tmp_msg_timeout > msg_timeout: @@ -418,7 +418,7 @@ power_timeout = int(options["--power-timeout"]) sbd_msg_timeout = get_msg_timeout(options) if 0 < power_timeout <= sbd_msg_timeout: - logging.warn("power timeout needs to be \ + logging.warning("power timeout needs to be \ greater then sbd message timeout") result = fence_action(\