From f946c7e733c57270283440e1fd701070ebddf9d9 Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Thu, 26 Jun 2014 17:52:04 -0700 Subject: [PATCH] Only warn about deprecation warnings once Instead of repeatly emitting data about which modules are deprecated again and again just warn about those deprecation once and then never warn about them again. This is a good thing to have, and will be needed as taskflow moves one of its classes used in cinder to a new and longer-term location and will emit deprecation about the usage of the old location. Change-Id: I962f9bab920a03eca235c9e4591d367687e44954 --- bin/cinder-all | 3 +++ bin/cinder-api | 3 +++ bin/cinder-backup | 3 +++ bin/cinder-clear-rabbit-queues | 3 +++ bin/cinder-manage | 3 +++ bin/cinder-rpc-zmq-receiver | 3 +++ bin/cinder-scheduler | 3 +++ bin/cinder-volume | 3 +++ bin/cinder-volume-usage-audit | 3 +++ 9 files changed, 27 insertions(+) diff --git a/bin/cinder-all b/bin/cinder-all index a3b2fcf7f..1e5842d88 100755 --- a/bin/cinder-all +++ b/bin/cinder-all @@ -32,6 +32,9 @@ eventlet.monkey_patch() import os import sys +import warnings + +warnings.simplefilter('once', DeprecationWarning) from oslo.config import cfg diff --git a/bin/cinder-api b/bin/cinder-api index 8990f641e..e5b411dee 100755 --- a/bin/cinder-api +++ b/bin/cinder-api @@ -22,6 +22,9 @@ eventlet.monkey_patch() import os import sys +import warnings + +warnings.simplefilter('once', DeprecationWarning) from oslo.config import cfg diff --git a/bin/cinder-backup b/bin/cinder-backup index 2b5a634cc..69f2c76bf 100755 --- a/bin/cinder-backup +++ b/bin/cinder-backup @@ -20,6 +20,9 @@ import os import sys +import warnings + +warnings.simplefilter('once', DeprecationWarning) import eventlet diff --git a/bin/cinder-clear-rabbit-queues b/bin/cinder-clear-rabbit-queues index 4a59b8b3d..bab50ec52 100755 --- a/bin/cinder-clear-rabbit-queues +++ b/bin/cinder-clear-rabbit-queues @@ -23,6 +23,9 @@ import os import sys +import warnings + +warnings.simplefilter('once', DeprecationWarning) from oslo.config import cfg diff --git a/bin/cinder-manage b/bin/cinder-manage index c9eec4ad9..a0c2df075 100755 --- a/bin/cinder-manage +++ b/bin/cinder-manage @@ -57,6 +57,9 @@ from __future__ import print_function import os import sys +import warnings + +warnings.simplefilter('once', DeprecationWarning) from oslo.config import cfg from oslo import messaging diff --git a/bin/cinder-rpc-zmq-receiver b/bin/cinder-rpc-zmq-receiver index 07db167b0..cd7d94a8f 100755 --- a/bin/cinder-rpc-zmq-receiver +++ b/bin/cinder-rpc-zmq-receiver @@ -19,6 +19,9 @@ eventlet.monkey_patch() import contextlib import os import sys +import warnings + +warnings.simplefilter('once', DeprecationWarning) # If ../cinder/__init__.py exists, add ../ to Python search path, so that # it will override what happens to be installed in /usr/(local/)lib/python... diff --git a/bin/cinder-scheduler b/bin/cinder-scheduler index e8ee1175b..a01fe3e4e 100755 --- a/bin/cinder-scheduler +++ b/bin/cinder-scheduler @@ -24,6 +24,9 @@ eventlet.monkey_patch() import os import sys +import warnings + +warnings.simplefilter('once', DeprecationWarning) from oslo.config import cfg diff --git a/bin/cinder-volume b/bin/cinder-volume index 5b8b8a8d9..45c4ed461 100755 --- a/bin/cinder-volume +++ b/bin/cinder-volume @@ -28,6 +28,9 @@ else: eventlet.monkey_patch() import sys +import warnings + +warnings.simplefilter('once', DeprecationWarning) from oslo.config import cfg diff --git a/bin/cinder-volume-usage-audit b/bin/cinder-volume-usage-audit index accca839d..3f223d38a 100755 --- a/bin/cinder-volume-usage-audit +++ b/bin/cinder-volume-usage-audit @@ -38,6 +38,9 @@ from datetime import datetime import os import sys import traceback +import warnings + +warnings.simplefilter('once', DeprecationWarning) from oslo.config import cfg -- 2.45.2