From eb8d3777ad03cbdeb70be489807cf94368bfedc2 Mon Sep 17 00:00:00 2001 From: gecong1973 Date: Wed, 16 Nov 2016 15:14:34 +0800 Subject: [PATCH] Replace LOG.warn with LOG.warning logging.warn is deprecated in Python 3.[1] [1] https://docs.python.org/3/library/logging.html#logging.warning Change-Id: Ia87055a5bf51aade370e69921956aee0189304a4 --- freezer/common/config.py | 8 ++++---- freezer/main.py | 2 +- freezer/openstack/osclients.py | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/freezer/common/config.py b/freezer/common/config.py index 4d9f2f64..0b8d8256 100644 --- a/freezer/common/config.py +++ b/freezer/common/config.py @@ -532,8 +532,8 @@ def get_backup_args(): if log_file: CONF.set_default('log_file', log_file) else: - LOG.warn("log file cannot be created. Freezer will proceed with " - "default stdout and stderr") + LOG.warning("log file cannot be created. Freezer will proceed with" + " default stdout and stderr") backup_args = FreezerConfig(defaults) @@ -648,8 +648,8 @@ def get_backup_args(): else: os.environ["tricklecount"] = str(1) else: - LOG.warn("Trickle not found. Switching to normal mode without " - "limiting bandwidth") + LOG.warning("Trickle not found. Switching to normal mode without " + "limiting bandwidth") if backup_args.config: # remove index tmp_file from backup arguments dict utils.delete_file(conf_file.name) diff --git a/freezer/main.py b/freezer/main.py index 94e0338b..da4b31d1 100644 --- a/freezer/main.py +++ b/freezer/main.py @@ -102,7 +102,7 @@ def freezer_main(backup_args): utils.delete_file(backup_args.tmp_file) if process.returncode: - LOG.warn("Trickle Error: {0}".format(error)) + LOG.warning("Trickle Error: {0}".format(error)) LOG.info("Switching to work without trickle ...") return run_job(backup_args, storage) diff --git a/freezer/openstack/osclients.py b/freezer/openstack/osclients.py index 2534b651..e3654cc0 100644 --- a/freezer/openstack/osclients.py +++ b/freezer/openstack/osclients.py @@ -236,7 +236,7 @@ class OSClientManager(object): time.sleep(5) except Exception as e: LOG.exception(e) - LOG.warn("Exception getting volume status") + LOG.warning("Exception getting volume status") return volume def make_glance_image(self, image_volume_name, copy_volume): @@ -264,7 +264,7 @@ class OSClientManager(object): if image.status in ("killed", "deleted"): raise LOG.exception(e) - LOG.warn("Exception getting image status") + LOG.warning("Exception getting image status") return image def clean_snapshot(self, snapshot):