Deprecate global functions in favor of ClientV1 methods
These are bulky and hard to update. Using a client instance is also more in line with other OpenStack clients. Change-Id: I60efeb1b54ea44e59382a2c9f6537677cff07597
This commit is contained in:
parent
25ea88c800
commit
7bfaca1597
23
README.rst
23
README.rst
@ -227,29 +227,6 @@ CLI::
|
||||
|
||||
$ openstack baremetal introspection rule delete <UUID>
|
||||
|
||||
Shortcut Functions
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The following functions are available for simplified access to the most common
|
||||
functionality:
|
||||
|
||||
* Starting introspection::
|
||||
|
||||
ironic_inspector_client.introspect(uuid[, new_ipmi_password[, new_ipmi_username]][, base_url][, api_version] **)
|
||||
|
||||
* Getting introspection status::
|
||||
|
||||
ironic_inspector_client.get_status(uuid[, base_url][, api_version] **)
|
||||
|
||||
* Getting API versions supported by a server::
|
||||
|
||||
ironic_inspector_client.server_api_versions([base_url] **)
|
||||
|
||||
Here ``base_url`` argument is the same as ``inspector_url`` argument
|
||||
to the ``ClientV1`` constructor. Keyword arguments are passed to the client
|
||||
constructor intact. The first 2 functions also accept deprecated ``auth_token``
|
||||
argument, which should not be used.
|
||||
|
||||
Using names instead of UUID
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
@ -13,10 +13,15 @@
|
||||
|
||||
"""Shorthand client functions using V1 API."""
|
||||
|
||||
import logging
|
||||
|
||||
from ironic_inspector_client.common import http
|
||||
from ironic_inspector_client.common.i18n import _LW
|
||||
from ironic_inspector_client import v1
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
DEFAULT_API_VERSION = v1.DEFAULT_API_VERSION
|
||||
MAX_API_VERSION = v1.MAX_API_VERSION
|
||||
|
||||
@ -31,6 +36,8 @@ def introspect(uuid, base_url=None, auth_token=None,
|
||||
api_version=DEFAULT_API_VERSION, session=None, **kwargs):
|
||||
"""Start introspection for a node.
|
||||
|
||||
This function is deprecated. Please use ClientV1.introspect.
|
||||
|
||||
:param uuid: node uuid
|
||||
:param base_url: *Ironic Inspector* URL in form: http://host:port[/ver],
|
||||
defaults to ``http://<current host>:5050/v1``.
|
||||
@ -48,6 +55,8 @@ def introspect(uuid, base_url=None, auth_token=None,
|
||||
:raises: VersionNotSupported if requested api_version is not supported
|
||||
:raises: *requests* library exception on connection problems.
|
||||
"""
|
||||
LOG.warning(_LW('The "introspect" function is deprecated, please use '
|
||||
'ClientV1.introspect method instead'))
|
||||
c = v1.ClientV1(api_version=api_version, auth_token=auth_token,
|
||||
inspector_url=base_url, session=session, **kwargs)
|
||||
return c.introspect(uuid, new_ipmi_username=new_ipmi_username,
|
||||
@ -58,6 +67,8 @@ def get_status(uuid, base_url=None, auth_token=None,
|
||||
api_version=DEFAULT_API_VERSION, session=None, **kwargs):
|
||||
"""Get introspection status for a node.
|
||||
|
||||
This function is deprecated. Please use ClientV1.get_status.
|
||||
|
||||
New in Ironic Inspector version 1.0.0.
|
||||
:param uuid: node uuid.
|
||||
:param base_url: *Ironic Inspector* URL in form: http://host:port[/ver],
|
||||
@ -71,6 +82,8 @@ def get_status(uuid, base_url=None, auth_token=None,
|
||||
:raises: VersionNotSupported if requested api_version is not supported
|
||||
:raises: *requests* library exception on connection problems.
|
||||
"""
|
||||
LOG.warning(_LW('The "get_status" function is deprecated, please use '
|
||||
'ClientV1.get_status method instead'))
|
||||
c = v1.ClientV1(api_version=api_version, auth_token=auth_token,
|
||||
inspector_url=base_url, session=session, **kwargs)
|
||||
return c.get_status(uuid)
|
||||
@ -79,6 +92,8 @@ def get_status(uuid, base_url=None, auth_token=None,
|
||||
def server_api_versions(base_url=None, session=None, **kwargs):
|
||||
"""Get minimum and maximum supported API versions from a server.
|
||||
|
||||
This function is deprecated. Please use ClientV1.server_api_versions.
|
||||
|
||||
:param base_url: *Ironic Inspector* URL in form: http://host:port[/ver],
|
||||
defaults to ``http://<current host>:5050/v1``.
|
||||
:param session: keystone session (authentication is not required).
|
||||
@ -88,6 +103,8 @@ def server_api_versions(base_url=None, session=None, **kwargs):
|
||||
:raises: *requests* library exception on connection problems.
|
||||
:raises: ValueError if returned version cannot be parsed
|
||||
"""
|
||||
LOG.warning(_LW('The "server_api_versions" function is deprecated, '
|
||||
'please use ClientV1.server_api_versions method instead'))
|
||||
c = http.BaseClient(1, inspector_url=base_url, session=session, **kwargs)
|
||||
return c.server_api_versions()
|
||||
|
||||
|
8
releasenotes/notes/old-functions-80ddae9eaa1e7e1d.yaml
Normal file
8
releasenotes/notes/old-functions-80ddae9eaa1e7e1d.yaml
Normal file
@ -0,0 +1,8 @@
|
||||
---
|
||||
deprecations:
|
||||
- |
|
||||
The following functions are deprecated in favor of ``ClientV1`` methods:
|
||||
|
||||
* ``ironic_inspector_client.introspect``
|
||||
* ``ironic_inspector_client.get_status``
|
||||
* ``ironic_inspector_client.server_api_versions``
|
Loading…
Reference in New Issue
Block a user