diff options
author | Michal Arbet <michal.arbet@ultimum.io> | 2018-08-29 14:17:36 +0200 |
---|---|---|
committer | Michal Arbet <michal.arbet@ultimum.io> | 2018-09-05 16:18:35 +0200 |
commit | 3749cd618b2b7dfc4442de06dfa5c876f9639bc7 (patch) | |
tree | f0d9562d511bdb16d4bac5b4a55c3d849b0fb3c9 /ironic/drivers/base.py | |
parent | 0a10eb7794e1543ce2be09c0a55b62fa005b0710 (diff) | |
download | ironic-3749cd618b2b7dfc4442de06dfa5c876f9639bc7.tar.gz |
Fix async keyword for Python 3.7
In Python 3.7, async becomes a keyword, and therefore we need
to change variable async.
The passthru() previously had async and async_call, we just remove
the old parameter.
scciclient moved from async to do_async as parameter, so we use that.
Change-Id: I35cb34d9ba78186de88ff7b56ab89ee6e24db6e6
Diffstat (limited to 'ironic/drivers/base.py')
-rw-r--r-- | ironic/drivers/base.py | 35 |
1 files changed, 7 insertions, 28 deletions
diff --git a/ironic/drivers/base.py b/ironic/drivers/base.py index 1c6a37609..a4a9485a8 100644 --- a/ironic/drivers/base.py +++ b/ironic/drivers/base.py @@ -646,7 +646,7 @@ VendorMetadata = collections.namedtuple('VendorMetadata', ['method', 'metadata']) -def _passthru(http_methods, method=None, async=None, async_call=None, +def _passthru(http_methods, method=None, async_call=True, driver_passthru=False, description=None, attach=False, require_exclusive_lock=True): """A decorator for registering a function as a passthru function. @@ -662,7 +662,6 @@ def _passthru(http_methods, method=None, async=None, async_call=None, :param http_methods: A list of supported HTTP methods by the vendor function. :param method: an arbitrary string describing the action to be taken. - :param async: Deprecated, please use async_call instead. :param async_call: Boolean value. If True invoke the passthru function asynchronously; if False, synchronously. If a passthru function touches the BMC we strongly recommend it to @@ -682,26 +681,6 @@ def _passthru(http_methods, method=None, async=None, async_call=None, for a synchronous passthru method. If False, don't lock the node. Defaults to True. """ - # TODO(rloo): In Stein cycle, remove support for 'async' parameter. - # The default value for 'async_call' should then be changed - # to True. - if async_call is None: - if async is not None: - LOG.warning( - 'The "async" parameter is deprecated, please use "async_call" ' - 'instead. The "async" parameter will be removed in the Stein ' - 'cycle.' - ) - async_call = async - else: - async_call = True - else: - if async is not None: - raise TypeError( - "'async_call' and 'async' parameters cannot be used together. " - "Use 'async_call' instead of 'async' since 'async' is " - "deprecated and will be removed in the Stein cycle." - ) def handle_passthru(func): api_method = method @@ -737,17 +716,17 @@ def _passthru(http_methods, method=None, async=None, async_call=None, return handle_passthru -def passthru(http_methods, method=None, async=None, description=None, - attach=False, require_exclusive_lock=True, async_call=None): - return _passthru(http_methods, method, async, async_call, +def passthru(http_methods, method=None, async_call=True, description=None, + attach=False, require_exclusive_lock=True): + return _passthru(http_methods, method, async_call, driver_passthru=False, description=description, attach=attach, require_exclusive_lock=require_exclusive_lock) -def driver_passthru(http_methods, method=None, async=None, description=None, - attach=False, async_call=None): - return _passthru(http_methods, method, async, async_call, +def driver_passthru(http_methods, method=None, async_call=True, + description=None, attach=False): + return _passthru(http_methods, method, async_call, driver_passthru=True, description=description, attach=attach) |