Merge "Cleanup docs - raises class"

This commit is contained in:
Jenkins
2014-11-18 19:18:13 +00:00
committed by Gerrit Code Review
14 changed files with 73 additions and 39 deletions

View File

@@ -94,7 +94,8 @@ class Adapter(object):
on the session. (optional)
:type auth: :class:`keystoneclient.auth.base.BaseAuthPlugin`
:raises AuthorizationFailure: if a new token fetch fails.
:raises keystoneclient.exceptions.AuthorizationFailure: if a new token
fetch fails.
:returns string: A valid token.
"""
@@ -107,7 +108,8 @@ class Adapter(object):
the session. (optional)
:type auth: :class:`keystoneclient.auth.base.BaseAuthPlugin`
:raises MissingAuthPlugin: if a plugin is not available.
:raises keystoneclient.exceptions.MissingAuthPlugin: if a plugin is not
available.
:returns string: An endpoint if available or None.
"""

View File

@@ -35,7 +35,8 @@ def get_plugin_class(name):
:returns: An auth plugin class.
:raises exceptions.NoMatchingPlugin: if a plugin cannot be created.
:raises keystoneclient.exceptions.NoMatchingPlugin: if a plugin cannot be
created.
"""
try:
mgr = stevedore.DriverManager(namespace=PLUGIN_NAMESPACE,

View File

@@ -31,7 +31,8 @@ def register_argparse_arguments(parser, argv, default=None):
:returns: The plugin class that will be loaded or None if not provided.
:raises exceptions.NoMatchingPlugin: if a plugin cannot be created.
:raises keystoneclient.exceptions.NoMatchingPlugin: if a plugin cannot be
created.
"""
in_parser = argparse.ArgumentParser(add_help=False)
env_plugin = os.environ.get('OS_AUTH_PLUGIN', default)
@@ -68,7 +69,8 @@ def load_from_argparse_arguments(namespace, **kwargs):
:returns: An auth plugin, or None if a name is not provided.
:raises exceptions.NoMatchingPlugin: if a plugin cannot be created.
:raises keystoneclient.exceptions.NoMatchingPlugin: if a plugin cannot be
created.
"""
if not namespace.os_auth_plugin:
return None

View File

@@ -90,7 +90,8 @@ def load_from_conf_options(conf, group, **kwargs):
:returns plugin: An authentication Plugin or None if a name is not provided
:raises exceptions.NoMatchingPlugin: if a plugin cannot be created.
:raises keystoneclient.exceptions.NoMatchingPlugin: if a plugin cannot be
created.
"""
# NOTE(jamielennox): plugins are allowed to specify a 'section' which is
# the group that auth options should be taken from. If not present they

View File

@@ -74,8 +74,11 @@ class BaseIdentityPlugin(base.BaseAuthPlugin):
when invoked. If you are looking to just retrieve the current auth
data then you should use get_access.
:raises InvalidResponse: The response returned wasn't appropriate.
:raises HttpError: An error from an invalid HTTP response.
:raises keystoneclient.exceptions.InvalidResponse: The response
returned wasn't
appropriate.
:raises keystoneclient.exceptions.HttpError: An error from an invalid
HTTP response.
:returns AccessInfo: Token access information.
"""
@@ -85,7 +88,8 @@ class BaseIdentityPlugin(base.BaseAuthPlugin):
If a valid token is not present then a new one will be fetched.
:raises HttpError: An error from an invalid HTTP response.
:raises keystoneclient.exceptions.HttpError: An error from an invalid
HTTP response.
:return string: A valid token.
"""
@@ -119,7 +123,8 @@ class BaseIdentityPlugin(base.BaseAuthPlugin):
If a valid AccessInfo is present then it is returned otherwise a new
one will be fetched.
:raises HttpError: An error from an invalid HTTP response.
:raises keystoneclient.exceptions.HttpError: An error from an invalid
HTTP response.
:returns AccessInfo: Valid AccessInfo
"""
@@ -170,7 +175,8 @@ class BaseIdentityPlugin(base.BaseAuthPlugin):
:param tuple version: The minimum version number required for this
endpoint. (optional)
:raises HttpError: An error from an invalid HTTP response.
:raises keystoneclient.exceptions.HttpError: An error from an invalid
HTTP response.
:return string or None: A valid endpoint URL or None if not available.
"""
@@ -242,8 +248,10 @@ class BaseIdentityPlugin(base.BaseAuthPlugin):
(optional) Defaults to None (use a token
if a plugin is installed).
:raises: DiscoveryFailure if for some reason the lookup fails.
:raises: HttpError An error from an invalid HTTP response.
:raises keystoneclient.exceptions.DiscoveryFailure: if for some reason
the lookup fails.
:raises keystoneclient.exceptions.HttpError: An error from an invalid
HTTP response.
:returns: A discovery object with the results of looking up that URL.
"""

View File

@@ -36,8 +36,10 @@ def Client(version=None, unstable=False, session=None, **kwargs):
:returns: New keystone client object
(keystoneclient.v2_0.Client or keystoneclient.v3.Client).
:raises: DiscoveryFailure if the server's response is invalid
:raises: VersionNotAvailable if a suitable client cannot be found.
:raises keystoneclient.exceptions.DiscoveryFailure: if the server's
response is invalid
:raises keystoneclient.exceptions.VersionNotAvailable: if a suitable client
cannot be found.
"""
if not session:
session = client_session.Session.construct(kwargs)

View File

@@ -135,8 +135,10 @@ def cms_verify(formatted, signing_cert_file_name, ca_file_name,
inform=PKI_ASN1_FORM):
"""Verifies the signature of the contents IAW CMS syntax.
:raises: subprocess.CalledProcessError
:raises: CertificateConfigError if certificate is not configured properly.
:raises subprocess.CalledProcessError:
:raises keystoneclient.exceptions.CertificateConfigError: if certificate
is not configured
properly.
"""
_ensure_subprocess()
if isinstance(formatted, six.string_types):

View File

@@ -520,7 +520,7 @@ class ADFSUnscopedToken(_BaseSAMLPlugin):
:param session
:returns: True if cookie jar is nonempty, False otherwise
:raises: AttributeError in case cookies are not find anywhere
:raises AttributeError: in case cookies are not find anywhere
"""
try:
@@ -705,11 +705,12 @@ class ADFSUnscopedToken(_BaseSAMLPlugin):
:param session : a session object to send out HTTP requests.
:type session: keystoneclient.session.Session
:raises: exceptions.AuthorizationFailure when HTTP response from the
ADFS server is not a valid XML ADFS security token.
:raises: exceptions.InternalServerError: If response status code is
HTTP 500 and the response XML cannot be recognized.
:raises keystoneclient.exceptions.AuthorizationFailure: when HTTP
response from the ADFS server is not a valid XML ADFS security
token.
:raises keystoneclient.exceptions.InternalServerError: If response
status code is HTTP 500 and the response XML cannot be
recognized.
"""
def _get_failure(e):
@@ -798,8 +799,8 @@ class ADFSUnscopedToken(_BaseSAMLPlugin):
:param session : a session object to send out HTTP requests.
:type session: keystoneclient.session.Session
:raises: exceptions.AuthorizationFailure: in case session object
has empty cookie jar.
:raises keystoneclient.exceptions.AuthorizationFailure: in case session
object has empty cookie jar.
"""
if self._cookies(session) is False:

View File

@@ -263,8 +263,10 @@ class Discover(_discover.Discover):
:returns: An instantiated identity client object.
:raises: DiscoveryFailure if the server response is invalid
:raises: VersionNotAvailable if a suitable client cannot be found.
:raises keystoneclient.exceptions.DiscoveryFailure: if the server
response is invalid
:raises keystoneclient.exceptions.VersionNotAvailable: if a suitable
client cannot be found.
"""
version_data = self._calculate_version(version, unstable)
return self._create_client(version_data, **kwargs)

View File

@@ -14,6 +14,15 @@
# under the License.
"""
Exception definitions.
.. py:exception:: AuthorizationFailure
.. py:exception:: ClientException
.. py:exception:: HttpError
.. py:exception:: Unauthorized
"""
from keystoneclient.i18n import _

View File

@@ -365,9 +365,10 @@ class HTTPClient(baseclient.Client, base.BaseAuthPlugin):
self.management_url from the details provided in the token.
:returns: ``True`` if authentication was successful.
:raises: AuthorizationFailure if unable to authenticate or validate
the existing authorization token
:raises: ValueError if insufficient parameters are used.
:raises keystoneclient.exceptions.AuthorizationFailure: if unable to
authenticate or validate the existing authorization token
:raises keystoneclient.exceptions.ValueError: if insufficient
parameters are used.
If keyring is used, token is retrieved from keyring instead.
Authentication will only be necessary if any of the following

View File

@@ -260,8 +260,8 @@ class Session(object):
'allow_redirects' is ignored as redirects are handled
by the session.
:raises exceptions.ClientException: For connection failure, or to
indicate an error response code.
:raises keystoneclient.exceptions.ClientException: For connection
failure, or to indicate an error response code.
:returns: The response to the request.
"""
@@ -501,7 +501,8 @@ class Session(object):
on the session. (optional)
:type auth: :class:`keystoneclient.auth.base.BaseAuthPlugin`
:raises AuthorizationFailure: if a new token fetch fails.
:raises keystoneclient.exceptions.AuthorizationFailure: if a new token
fetch fails.
:returns string: A valid token.
"""
@@ -524,7 +525,8 @@ class Session(object):
the session. (optional)
:type auth: :class:`keystoneclient.auth.base.BaseAuthPlugin`
:raises MissingAuthPlugin: if a plugin is not available.
:raises keystoneclient.exceptions.MissingAuthPlugin: if a plugin is not
available.
:returns string: An endpoint if available or None.
"""

View File

@@ -159,8 +159,8 @@ class Client(httpclient.HTTPClient):
password.
:returns: access.AccessInfo if authentication was successful.
:raises: AuthorizationFailure if unable to authenticate or validate
the existing authorization token
:raises keystoneclient.exceptions.AuthorizationFailure: if unable to
authenticate or validate the existing authorization token
"""
try:
if auth_url is None:

View File

@@ -229,9 +229,10 @@ EndpointPolicyManager`
be used in the request.
:returns: access.AccessInfo if authentication was successful.
:raises: AuthorizationFailure if unable to authenticate or validate
the existing authorization token
:raises: Unauthorized if authentication fails due to invalid token
:raises keystoneclient.exceptions.AuthorizationFailure: if unable to
authenticate or validate the existing authorization token.
:raises keystoneclient.exceptions.Unauthorized: if authentication fails
due to invalid token.
"""
try: