From: Jay S. Bryant Date: Fri, 19 Dec 2014 22:30:31 +0000 (-0600) Subject: Sync periodic_task module from oslo-incubator X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=41239fd65666e6dba2ca3012c8187d6c34dce9a0;p=openstack-build%2Fcinder-build.git Sync periodic_task module from oslo-incubator The periodic_task module hasn't been sync'd since the middle of the Juno release cycle. This patch brings it up to date with the latest oslo-incubator code. Current HEAD in OSLO: --------------------- commit 36b0e8570b449129d6d474c03b02ceb62edb78df Date: Thu Dec 11 11:27:08 2014 +0100 We shouldn't replace `oslo-incubator` in comments Changes merged with this patch: --------------------- 5d40e143 - Remove code that moved to oslo.i18n a3220c51 - add list_opts to all modules with configuration options Change-Id: I0d68ba54617be550244969b7672e95158126f64a --- diff --git a/cinder/openstack/common/periodic_task.py b/cinder/openstack/common/periodic_task.py index c4a2bd37f..f05bca10b 100644 --- a/cinder/openstack/common/periodic_task.py +++ b/cinder/openstack/common/periodic_task.py @@ -11,13 +11,14 @@ # License for the specific language governing permissions and limitations # under the License. +import copy import random import time from oslo.config import cfg import six -from cinder.openstack.common.gettextutils import _, _LE, _LI +from cinder.openstack.common._i18n import _, _LE, _LI from cinder.openstack.common import log as logging @@ -36,6 +37,11 @@ LOG = logging.getLogger(__name__) DEFAULT_INTERVAL = 60.0 +def list_opts(): + """Entry point for oslo.config-generator.""" + return [(None, copy.deepcopy(periodic_opts))] + + class InvalidPeriodicTaskArg(Exception): message = _("Unexpected argument for periodic task creation: %(arg)s.")