Deprecate "wait_for" methods on ProxyBase

The wait_for_status and wait_for_delete methods on ProxyBase end up
attached to every service-specific proxy, though they're not generally
applicable. The proxy methods as they are just simply expose what's
available on the resource base class, so any direct users in a proxy
subclass should instead implement this on their own when it's needed.

Currently, only compute uses this kind of functionality, and it rightly
implements it itself by going to the resource2 module and calling the
module-level functions. Internally, we do have a few uses of the
wait_for methods attached to proxies, though they're all in functional
tests (for block_store, compute, and orchestration). We should consider
exposing those methods directly on those proxies rather than exposing
the methods through the base class to dozens of services that don't have
those needs.

These should be removed for 1.0. They're also currently generating
warnings on every service's documentation via the enforcer tool for not
being documented (which was how this was originally found).

Change-Id: I4733161959ab282915f1cc2956245a377417fced
This commit is contained in:
Brian Curtin 2017-02-15 11:32:18 -05:00
parent 8be6aed0ca
commit 9260f8404c

View File

@ -12,6 +12,7 @@
from openstack import exceptions
from openstack import resource2
from openstack import utils
# The _check_resource decorator is used on BaseProxy methods to ensure that
@ -269,6 +270,11 @@ class BaseProxy(object):
res = self._get_resource(resource_type, value, **attrs)
return res.head(self.session)
@utils.deprecated(deprecated_in="0.9.14", removed_in="1.0",
details=("This is no longer a part of the proxy base, "
"service-specific subclasses should expose "
"this as needed. See resource2.wait_for_status "
"for this behavior"))
def wait_for_status(self, value, status, failures=[], interval=2,
wait=120):
"""Wait for a resource to be in a particular status.
@ -293,6 +299,11 @@ class BaseProxy(object):
return resource2.wait_for_status(self.session, value, status,
failures, interval, wait)
@utils.deprecated(deprecated_in="0.9.14", removed_in="1.0",
details=("This is no longer a part of the proxy base, "
"service-specific subclasses should expose "
"this as needed. See resource2.wait_for_delete "
"for this behavior"))
def wait_for_delete(self, value, interval=2, wait=120):
"""Wait for the resource to be deleted.