Fix D401 PEP257 violation.
Currently tox ignores D401. 401: First line should be in imperative mood. This change removes it and make keystoneclient docstrings compliant with it. Change-Id: If34ff12d18390b357342cf29f2d116dd3c86a44d
This commit is contained in:
@@ -97,7 +97,7 @@ class AccessInfo(dict):
|
|||||||
return self.get('region_name')
|
return self.get('region_name')
|
||||||
|
|
||||||
def will_expire_soon(self, stale_duration=None):
|
def will_expire_soon(self, stale_duration=None):
|
||||||
"""Determines if expiration is about to occur.
|
"""Determine if expiration is about to occur.
|
||||||
|
|
||||||
:returns: true if expiration is within the given duration
|
:returns: true if expiration is within the given duration
|
||||||
:rtype: boolean
|
:rtype: boolean
|
||||||
@@ -114,7 +114,7 @@ class AccessInfo(dict):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def is_valid(cls, body, **kwargs):
|
def is_valid(cls, body, **kwargs):
|
||||||
"""Determines if processing valid v2 or v3 token.
|
"""Determine if processing valid v2 or v3 token.
|
||||||
|
|
||||||
Validates from the auth body or a user-provided dict.
|
Validates from the auth body or a user-provided dict.
|
||||||
|
|
||||||
@@ -124,7 +124,7 @@ class AccessInfo(dict):
|
|||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
def has_service_catalog(self):
|
def has_service_catalog(self):
|
||||||
"""Returns true if the authorization token has a service catalog.
|
"""Return true if the authorization token has a service catalog.
|
||||||
|
|
||||||
:returns: boolean
|
:returns: boolean
|
||||||
"""
|
"""
|
||||||
@@ -132,7 +132,7 @@ class AccessInfo(dict):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def auth_token(self):
|
def auth_token(self):
|
||||||
"""Returns the token_id associated with the auth request.
|
"""Return the token_id associated with the auth request.
|
||||||
|
|
||||||
To be used in headers for authenticating OpenStack API requests.
|
To be used in headers for authenticating OpenStack API requests.
|
||||||
|
|
||||||
@@ -153,7 +153,7 @@ class AccessInfo(dict):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def expires(self):
|
def expires(self):
|
||||||
"""Returns the token expiration (as datetime object)
|
"""Return the token expiration (as datetime object)
|
||||||
|
|
||||||
:returns: datetime
|
:returns: datetime
|
||||||
"""
|
"""
|
||||||
@@ -161,7 +161,7 @@ class AccessInfo(dict):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def issued(self):
|
def issued(self):
|
||||||
"""Returns the token issue time (as datetime object)
|
"""Return the token issue time (as datetime object)
|
||||||
|
|
||||||
:returns: datetime
|
:returns: datetime
|
||||||
"""
|
"""
|
||||||
@@ -169,7 +169,7 @@ class AccessInfo(dict):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def username(self):
|
def username(self):
|
||||||
"""Returns the username associated with the auth request.
|
"""Return the username associated with the auth request.
|
||||||
|
|
||||||
Follows the pattern defined in the V2 API of first looking for 'name',
|
Follows the pattern defined in the V2 API of first looking for 'name',
|
||||||
returning that if available, and falling back to 'username' if name
|
returning that if available, and falling back to 'username' if name
|
||||||
@@ -181,7 +181,7 @@ class AccessInfo(dict):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def user_id(self):
|
def user_id(self):
|
||||||
"""Returns the user id associated with the auth request.
|
"""Return the user id associated with the auth request.
|
||||||
|
|
||||||
:returns: str
|
:returns: str
|
||||||
"""
|
"""
|
||||||
@@ -189,7 +189,7 @@ class AccessInfo(dict):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def user_domain_id(self):
|
def user_domain_id(self):
|
||||||
"""Returns the user's domain id associated with the auth request.
|
"""Return the user's domain id associated with the auth request.
|
||||||
|
|
||||||
For v2, it always returns 'default' which may be different from the
|
For v2, it always returns 'default' which may be different from the
|
||||||
Keystone configuration.
|
Keystone configuration.
|
||||||
@@ -200,7 +200,7 @@ class AccessInfo(dict):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def user_domain_name(self):
|
def user_domain_name(self):
|
||||||
"""Returns the user's domain name associated with the auth request.
|
"""Return the user's domain name associated with the auth request.
|
||||||
|
|
||||||
For v2, it always returns 'Default' which may be different from the
|
For v2, it always returns 'Default' which may be different from the
|
||||||
Keystone configuration.
|
Keystone configuration.
|
||||||
@@ -211,7 +211,7 @@ class AccessInfo(dict):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def role_ids(self):
|
def role_ids(self):
|
||||||
"""Returns a list of user's role ids associated with the auth request.
|
"""Return a list of user's role ids associated with the auth request.
|
||||||
|
|
||||||
:returns: a list of strings of role ids
|
:returns: a list of strings of role ids
|
||||||
"""
|
"""
|
||||||
@@ -219,7 +219,7 @@ class AccessInfo(dict):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def role_names(self):
|
def role_names(self):
|
||||||
"""Returns a list of user's role names associated with the auth request.
|
"""Return a list of user's role names associated with the auth request.
|
||||||
|
|
||||||
:returns: a list of strings of role names
|
:returns: a list of strings of role names
|
||||||
"""
|
"""
|
||||||
@@ -227,7 +227,7 @@ class AccessInfo(dict):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def domain_name(self):
|
def domain_name(self):
|
||||||
"""Returns the domain name associated with the auth request.
|
"""Return the domain name associated with the auth request.
|
||||||
|
|
||||||
:returns: str or None (if no domain associated with the token)
|
:returns: str or None (if no domain associated with the token)
|
||||||
"""
|
"""
|
||||||
@@ -235,7 +235,7 @@ class AccessInfo(dict):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def domain_id(self):
|
def domain_id(self):
|
||||||
"""Returns the domain id associated with the auth request.
|
"""Return the domain id associated with the auth request.
|
||||||
|
|
||||||
:returns: str or None (if no domain associated with the token)
|
:returns: str or None (if no domain associated with the token)
|
||||||
"""
|
"""
|
||||||
@@ -243,7 +243,7 @@ class AccessInfo(dict):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def project_name(self):
|
def project_name(self):
|
||||||
"""Returns the project name associated with the auth request.
|
"""Return the project name associated with the auth request.
|
||||||
|
|
||||||
:returns: str or None (if no project associated with the token)
|
:returns: str or None (if no project associated with the token)
|
||||||
"""
|
"""
|
||||||
@@ -256,9 +256,9 @@ class AccessInfo(dict):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def scoped(self):
|
def scoped(self):
|
||||||
"""Returns true if the auth token was scoped.
|
"""Return true if the auth token was scoped.
|
||||||
|
|
||||||
Returns true if scoped to a tenant(project) or domain,
|
Return true if scoped to a tenant(project) or domain,
|
||||||
and contains a populated service catalog.
|
and contains a populated service catalog.
|
||||||
|
|
||||||
.. warning::
|
.. warning::
|
||||||
@@ -272,7 +272,7 @@ class AccessInfo(dict):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def project_scoped(self):
|
def project_scoped(self):
|
||||||
"""Returns true if the auth token was scoped to a tenant(project).
|
"""Return true if the auth token was scoped to a tenant(project).
|
||||||
|
|
||||||
:returns: bool
|
:returns: bool
|
||||||
"""
|
"""
|
||||||
@@ -280,7 +280,7 @@ class AccessInfo(dict):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def domain_scoped(self):
|
def domain_scoped(self):
|
||||||
"""Returns true if the auth token was scoped to a domain.
|
"""Return true if the auth token was scoped to a domain.
|
||||||
|
|
||||||
:returns: bool
|
:returns: bool
|
||||||
"""
|
"""
|
||||||
@@ -288,7 +288,7 @@ class AccessInfo(dict):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def trust_id(self):
|
def trust_id(self):
|
||||||
"""Returns the trust id associated with the auth request.
|
"""Return the trust id associated with the auth request.
|
||||||
|
|
||||||
:returns: str or None (if no trust associated with the token)
|
:returns: str or None (if no trust associated with the token)
|
||||||
"""
|
"""
|
||||||
@@ -296,7 +296,7 @@ class AccessInfo(dict):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def trust_scoped(self):
|
def trust_scoped(self):
|
||||||
"""Returns true if the auth token was scoped from a delegated trust.
|
"""Return true if the auth token was scoped from a delegated trust.
|
||||||
|
|
||||||
The trust delegation is via the OS-TRUST v3 extension.
|
The trust delegation is via the OS-TRUST v3 extension.
|
||||||
|
|
||||||
@@ -306,7 +306,7 @@ class AccessInfo(dict):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def trustee_user_id(self):
|
def trustee_user_id(self):
|
||||||
"""Returns the trustee user id associated with a trust.
|
"""Return the trustee user id associated with a trust.
|
||||||
|
|
||||||
:returns: str or None (if no trust associated with the token)
|
:returns: str or None (if no trust associated with the token)
|
||||||
"""
|
"""
|
||||||
@@ -314,7 +314,7 @@ class AccessInfo(dict):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def trustor_user_id(self):
|
def trustor_user_id(self):
|
||||||
"""Returns the trustor user id associated with a trust.
|
"""Return the trustor user id associated with a trust.
|
||||||
|
|
||||||
:returns: str or None (if no trust associated with the token)
|
:returns: str or None (if no trust associated with the token)
|
||||||
"""
|
"""
|
||||||
@@ -322,7 +322,7 @@ class AccessInfo(dict):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def project_id(self):
|
def project_id(self):
|
||||||
"""Returns the project ID associated with the auth request.
|
"""Return the project ID associated with the auth request.
|
||||||
|
|
||||||
This returns None if the auth token wasn't scoped to a project.
|
This returns None if the auth token wasn't scoped to a project.
|
||||||
|
|
||||||
@@ -337,7 +337,7 @@ class AccessInfo(dict):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def project_domain_id(self):
|
def project_domain_id(self):
|
||||||
"""Returns the project's domain id associated with the auth request.
|
"""Return the project's domain id associated with the auth request.
|
||||||
|
|
||||||
For v2, it returns 'default' if a project is scoped or None which may
|
For v2, it returns 'default' if a project is scoped or None which may
|
||||||
be different from the keystone configuration.
|
be different from the keystone configuration.
|
||||||
@@ -348,7 +348,7 @@ class AccessInfo(dict):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def project_domain_name(self):
|
def project_domain_name(self):
|
||||||
"""Returns the project's domain name associated with the auth request.
|
"""Return the project's domain name associated with the auth request.
|
||||||
|
|
||||||
For v2, it returns 'Default' if a project is scoped or None which may
|
For v2, it returns 'Default' if a project is scoped or None which may
|
||||||
be different from the keystone configuration.
|
be different from the keystone configuration.
|
||||||
@@ -359,7 +359,7 @@ class AccessInfo(dict):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def auth_url(self):
|
def auth_url(self):
|
||||||
"""Returns a tuple of identity URLs.
|
"""Return a tuple of identity URLs.
|
||||||
|
|
||||||
The identity URLs are from publicURL and adminURL for the service
|
The identity URLs are from publicURL and adminURL for the service
|
||||||
'identity' from the service catalog associated with the authorization
|
'identity' from the service catalog associated with the authorization
|
||||||
@@ -376,7 +376,7 @@ class AccessInfo(dict):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def management_url(self):
|
def management_url(self):
|
||||||
"""Returns the first adminURL of the identity endpoint.
|
"""Return the first adminURL of the identity endpoint.
|
||||||
|
|
||||||
The identity endpoint is from the service catalog
|
The identity endpoint is from the service catalog
|
||||||
associated with the authorization request, or None if the
|
associated with the authorization request, or None if the
|
||||||
@@ -392,7 +392,7 @@ class AccessInfo(dict):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def version(self):
|
def version(self):
|
||||||
"""Returns the version of the auth token from identity service.
|
"""Return the version of the auth token from identity service.
|
||||||
|
|
||||||
:returns: str
|
:returns: str
|
||||||
"""
|
"""
|
||||||
@@ -416,7 +416,7 @@ class AccessInfo(dict):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def is_federated(self):
|
def is_federated(self):
|
||||||
"""Returns true if federation was used to get the token.
|
"""Return true if federation was used to get the token.
|
||||||
|
|
||||||
:returns: boolean
|
:returns: boolean
|
||||||
"""
|
"""
|
||||||
|
@@ -114,14 +114,14 @@ class BaseGenericPlugin(base.BaseIdentityPlugin):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def _v2_params(self):
|
def _v2_params(self):
|
||||||
"""Parameters that are common to v2 plugins."""
|
"""Return parameters that are common to v2 plugins."""
|
||||||
return {'trust_id': self._trust_id,
|
return {'trust_id': self._trust_id,
|
||||||
'tenant_id': self._project_id,
|
'tenant_id': self._project_id,
|
||||||
'tenant_name': self._project_name}
|
'tenant_name': self._project_name}
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def _v3_params(self):
|
def _v3_params(self):
|
||||||
"""Parameters that are common to v3 plugins."""
|
"""Return parameters that are common to v3 plugins."""
|
||||||
return {'trust_id': self._trust_id,
|
return {'trust_id': self._trust_id,
|
||||||
'project_id': self._project_id,
|
'project_id': self._project_id,
|
||||||
'project_name': self._project_name,
|
'project_name': self._project_name,
|
||||||
|
@@ -298,7 +298,7 @@ class CrudManager(Manager):
|
|||||||
base_url = None
|
base_url = None
|
||||||
|
|
||||||
def build_url(self, dict_args_in_out=None):
|
def build_url(self, dict_args_in_out=None):
|
||||||
"""Builds a resource URL for the given kwargs.
|
"""Build a resource URL for the given kwargs.
|
||||||
|
|
||||||
Given an example collection where `collection_key = 'entities'` and
|
Given an example collection where `collection_key = 'entities'` and
|
||||||
`key = 'entity'`, the following URL's could be generated.
|
`key = 'entity'`, the following URL's could be generated.
|
||||||
@@ -355,7 +355,7 @@ class CrudManager(Manager):
|
|||||||
return '?%s' % urllib.parse.urlencode(params) if params else ''
|
return '?%s' % urllib.parse.urlencode(params) if params else ''
|
||||||
|
|
||||||
def build_key_only_query(self, params_list):
|
def build_key_only_query(self, params_list):
|
||||||
"""Builds a query that does not include values, just keys.
|
"""Build a query that does not include values, just keys.
|
||||||
|
|
||||||
The Identity API has some calls that define queries without values,
|
The Identity API has some calls that define queries without values,
|
||||||
this can not be accomplished by using urllib.parse.urlencode(). This
|
this can not be accomplished by using urllib.parse.urlencode(). This
|
||||||
|
@@ -153,7 +153,7 @@ def _encoding_for_form(inform):
|
|||||||
|
|
||||||
def cms_verify(formatted, signing_cert_file_name, ca_file_name,
|
def cms_verify(formatted, signing_cert_file_name, ca_file_name,
|
||||||
inform=PKI_ASN1_FORM):
|
inform=PKI_ASN1_FORM):
|
||||||
"""Verifies the signature of the contents IAW CMS syntax.
|
"""Verify the signature of the contents IAW CMS syntax.
|
||||||
|
|
||||||
:raises subprocess.CalledProcessError:
|
:raises subprocess.CalledProcessError:
|
||||||
:raises keystoneclient.exceptions.CertificateConfigError: if certificate
|
:raises keystoneclient.exceptions.CertificateConfigError: if certificate
|
||||||
@@ -241,7 +241,7 @@ def pkiz_verify(signed_text, signing_cert_file_name, ca_file_name):
|
|||||||
|
|
||||||
|
|
||||||
def token_to_cms(signed_text):
|
def token_to_cms(signed_text):
|
||||||
"""Converts a custom formatted token to a PEM-formatted token.
|
"""Convert a custom formatted token to a PEM-formatted token.
|
||||||
|
|
||||||
See documentation for cms_to_token() for details on the custom formatting.
|
See documentation for cms_to_token() for details on the custom formatting.
|
||||||
"""
|
"""
|
||||||
@@ -329,7 +329,7 @@ def cms_sign_text(data_to_sign, signing_cert_file_name, signing_key_file_name,
|
|||||||
def cms_sign_data(data_to_sign, signing_cert_file_name, signing_key_file_name,
|
def cms_sign_data(data_to_sign, signing_cert_file_name, signing_key_file_name,
|
||||||
outform=PKI_ASN1_FORM,
|
outform=PKI_ASN1_FORM,
|
||||||
message_digest=DEFAULT_TOKEN_DIGEST_ALGORITHM):
|
message_digest=DEFAULT_TOKEN_DIGEST_ALGORITHM):
|
||||||
"""Uses OpenSSL to sign a document.
|
"""Use OpenSSL to sign a document.
|
||||||
|
|
||||||
Produces a Base64 encoding of a DER formatted CMS Document
|
Produces a Base64 encoding of a DER formatted CMS Document
|
||||||
http://en.wikipedia.org/wiki/Cryptographic_Message_Syntax
|
http://en.wikipedia.org/wiki/Cryptographic_Message_Syntax
|
||||||
@@ -386,7 +386,7 @@ def cms_sign_token(text, signing_cert_file_name, signing_key_file_name,
|
|||||||
|
|
||||||
|
|
||||||
def cms_to_token(cms_text):
|
def cms_to_token(cms_text):
|
||||||
"""Converts a CMS-signed token in PEM format to a custom URL-safe format.
|
"""Convert a CMS-signed token in PEM format to a custom URL-safe format.
|
||||||
|
|
||||||
The conversion consists of replacing '/' char in the PEM-formatted token
|
The conversion consists of replacing '/' char in the PEM-formatted token
|
||||||
with the '-' char and doing other such textual replacements to make the
|
with the '-' char and doing other such textual replacements to make the
|
||||||
|
@@ -107,7 +107,7 @@ class RevokeTree(object):
|
|||||||
self.add_events(revoke_events)
|
self.add_events(revoke_events)
|
||||||
|
|
||||||
def add_event(self, event):
|
def add_event(self, event):
|
||||||
"""Updates the tree based on a revocation event.
|
"""Update the tree based on a revocation event.
|
||||||
|
|
||||||
Creates any necessary internal nodes in the tree corresponding to the
|
Creates any necessary internal nodes in the tree corresponding to the
|
||||||
fields of the revocation event. The leaf node will always be set to
|
fields of the revocation event. The leaf node will always be set to
|
||||||
|
@@ -339,7 +339,7 @@ class Discover(_discover.Discover):
|
|||||||
|
|
||||||
|
|
||||||
def add_catalog_discover_hack(service_type, old, new):
|
def add_catalog_discover_hack(service_type, old, new):
|
||||||
"""Adds a version removal rule for a particular service.
|
"""Add a version removal rule for a particular service.
|
||||||
|
|
||||||
Originally deployments of OpenStack would contain a versioned endpoint in
|
Originally deployments of OpenStack would contain a versioned endpoint in
|
||||||
the catalog for different services. E.g. an identity service might look
|
the catalog for different services. E.g. an identity service might look
|
||||||
|
@@ -337,7 +337,7 @@ An alias of :py:exc:`keystoneauth1.exceptions.http.HttpVersionNotSupported`
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from_response = _exc.from_response
|
from_response = _exc.from_response
|
||||||
"""Returns an instance of :class:`HttpError` or subclass based on response.
|
"""Return an instance of :class:`HttpError` or subclass based on response.
|
||||||
|
|
||||||
An alias of :py:func:`keystoneauth1.exceptions.http.from_response`
|
An alias of :py:func:`keystoneauth1.exceptions.http.from_response`
|
||||||
"""
|
"""
|
||||||
|
@@ -75,14 +75,14 @@ class Client(httpclient.HTTPClient):
|
|||||||
return self._local_keystone_exists()
|
return self._local_keystone_exists()
|
||||||
|
|
||||||
def _local_keystone_exists(self):
|
def _local_keystone_exists(self):
|
||||||
"""Checks if Keystone is available on default local port 35357."""
|
"""Check if Keystone is available on default local port 35357."""
|
||||||
results = self._check_keystone_versions("http://localhost:35357")
|
results = self._check_keystone_versions("http://localhost:35357")
|
||||||
if results is None:
|
if results is None:
|
||||||
results = self._check_keystone_versions("https://localhost:35357")
|
results = self._check_keystone_versions("https://localhost:35357")
|
||||||
return results
|
return results
|
||||||
|
|
||||||
def _check_keystone_versions(self, url):
|
def _check_keystone_versions(self, url):
|
||||||
"""Calls Keystone URL and detects the available API versions."""
|
"""Call Keystone URL and detects the available API versions."""
|
||||||
try:
|
try:
|
||||||
resp, body = self._request(url, "GET",
|
resp, body = self._request(url, "GET",
|
||||||
headers={'Accept':
|
headers={'Accept':
|
||||||
@@ -144,7 +144,7 @@ class Client(httpclient.HTTPClient):
|
|||||||
return self._check_keystone_extensions(url)
|
return self._check_keystone_extensions(url)
|
||||||
|
|
||||||
def _check_keystone_extensions(self, url):
|
def _check_keystone_extensions(self, url):
|
||||||
"""Calls Keystone URL and detects the available extensions."""
|
"""Call Keystone URL and detects the available extensions."""
|
||||||
try:
|
try:
|
||||||
if not url.endswith("/"):
|
if not url.endswith("/"):
|
||||||
url += '/'
|
url += '/'
|
||||||
@@ -173,7 +173,7 @@ class Client(httpclient.HTTPClient):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _get_version_info(version, root_url):
|
def _get_version_info(version, root_url):
|
||||||
"""Parses version information.
|
"""Parse version information.
|
||||||
|
|
||||||
:param version: a dict of a Keystone version response
|
:param version: a dict of a Keystone version response
|
||||||
:param root_url: string url used to construct
|
:param root_url: string url used to construct
|
||||||
@@ -192,7 +192,7 @@ class Client(httpclient.HTTPClient):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _get_extension_info(extension):
|
def _get_extension_info(extension):
|
||||||
"""Parses extension information.
|
"""Parse extension information.
|
||||||
|
|
||||||
:param extension: a dict of a Keystone extension response
|
:param extension: a dict of a Keystone extension response
|
||||||
:returns: tuple - (alias, name)
|
:returns: tuple - (alias, name)
|
||||||
|
@@ -447,11 +447,11 @@ class HTTPClient(baseclient.Client, base.BaseAuthPlugin):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def service_catalog(self):
|
def service_catalog(self):
|
||||||
"""Returns this client's service catalog."""
|
"""Return this client's service catalog."""
|
||||||
return self.auth_ref.service_catalog
|
return self.auth_ref.service_catalog
|
||||||
|
|
||||||
def has_service_catalog(self):
|
def has_service_catalog(self):
|
||||||
"""Returns True if this client provides a service catalog."""
|
"""Return True if this client provides a service catalog."""
|
||||||
return self.auth_ref and self.auth_ref.has_service_catalog()
|
return self.auth_ref and self.auth_ref.has_service_catalog()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -608,7 +608,7 @@ class HTTPClient(baseclient.Client, base.BaseAuthPlugin):
|
|||||||
|
|
||||||
Used to store and retrieve auth_ref from keyring.
|
Used to store and retrieve auth_ref from keyring.
|
||||||
|
|
||||||
Returns a slash-separated string of values ordered by key name.
|
Return a slash-separated string of values ordered by key name.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return '/'.join([kwargs[k] or '?' for k in sorted(kwargs)])
|
return '/'.join([kwargs[k] or '?' for k in sorted(kwargs)])
|
||||||
@@ -751,7 +751,7 @@ class HTTPClient(baseclient.Client, base.BaseAuthPlugin):
|
|||||||
return self._adapter.request(*args, **kwargs)
|
return self._adapter.request(*args, **kwargs)
|
||||||
|
|
||||||
def _cs_request(self, url, method, management=True, **kwargs):
|
def _cs_request(self, url, method, management=True, **kwargs):
|
||||||
"""Makes an authenticated request to keystone endpoint.
|
"""Make an authenticated request to keystone endpoint.
|
||||||
|
|
||||||
Request are made to keystone endpoint by concatenating
|
Request are made to keystone endpoint by concatenating
|
||||||
self.management_url and url and passing in method and
|
self.management_url and url and passing in method and
|
||||||
|
@@ -162,7 +162,7 @@ class Session(object):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _process_header(header):
|
def _process_header(header):
|
||||||
"""Redacts the secure headers to be logged."""
|
"""Redact the secure headers to be logged."""
|
||||||
secure_headers = ('authorization', 'x-auth-token',
|
secure_headers = ('authorization', 'x-auth-token',
|
||||||
'x-subject-token',)
|
'x-subject-token',)
|
||||||
if header[0].lower() in secure_headers:
|
if header[0].lower() in secure_headers:
|
||||||
@@ -545,7 +545,7 @@ class Session(object):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def construct(cls, kwargs):
|
def construct(cls, kwargs):
|
||||||
"""Handles constructing a session from both old and new arguments.
|
"""Handle constructing a session from both old and new arguments.
|
||||||
|
|
||||||
Support constructing a session from the old
|
Support constructing a session from the old
|
||||||
:py:class:`~keystoneclient.httpclient.HTTPClient` args as well as the
|
:py:class:`~keystoneclient.httpclient.HTTPClient` args as well as the
|
||||||
|
@@ -20,7 +20,7 @@ OPENSTACK_CLOUDS = ('functional_admin', 'devstack-admin', 'envvars')
|
|||||||
|
|
||||||
|
|
||||||
def get_client(version):
|
def get_client(version):
|
||||||
"""Creates a keystoneclient instance to run functional tests
|
"""Create a keystoneclient instance to run functional tests
|
||||||
|
|
||||||
The client is instantiated via os-client-config either based on a
|
The client is instantiated via os-client-config either based on a
|
||||||
clouds.yaml config file or from the environment variables.
|
clouds.yaml config file or from the environment variables.
|
||||||
|
@@ -124,7 +124,7 @@ class ProjectTests(utils.ClientTestCase, utils.CrudTests):
|
|||||||
self.assertEntityRequestBodyIs(ref)
|
self.assertEntityRequestBodyIs(ref)
|
||||||
|
|
||||||
def _create_projects_hierarchy(self, hierarchy_size=3):
|
def _create_projects_hierarchy(self, hierarchy_size=3):
|
||||||
"""Creates a project hierarchy with specified size.
|
"""Create a project hierarchy with specified size.
|
||||||
|
|
||||||
:param hierarchy_size: the desired hierarchy size, default is 3.
|
:param hierarchy_size: the desired hierarchy size, default is 3.
|
||||||
|
|
||||||
|
@@ -20,7 +20,7 @@ from keystoneclient.tests.unit import utils
|
|||||||
|
|
||||||
|
|
||||||
def parameterize(ref):
|
def parameterize(ref):
|
||||||
"""Rewrites attributes to match the kwarg naming convention in client.
|
"""Rewrite attributes to match the kwarg naming convention in client.
|
||||||
|
|
||||||
>>> parameterize({'project_id': 0})
|
>>> parameterize({'project_id': 0})
|
||||||
{'project': 0}
|
{'project': 0}
|
||||||
|
@@ -54,7 +54,7 @@ def find_resource(manager, name_or_id):
|
|||||||
|
|
||||||
|
|
||||||
def unauthenticated(f):
|
def unauthenticated(f):
|
||||||
"""Adds 'unauthenticated' attribute to decorated function.
|
"""Add 'unauthenticated' attribute to decorated function.
|
||||||
|
|
||||||
Usage::
|
Usage::
|
||||||
|
|
||||||
|
@@ -56,7 +56,7 @@ class RoleManager(base.ManagerWithFind):
|
|||||||
return self._list("/users/%s/roles" % user_id, "roles")
|
return self._list("/users/%s/roles" % user_id, "roles")
|
||||||
|
|
||||||
def add_user_role(self, user, role, tenant=None):
|
def add_user_role(self, user, role, tenant=None):
|
||||||
"""Adds a role to a user.
|
"""Add a role to a user.
|
||||||
|
|
||||||
If tenant is specified, the role is added just for that tenant,
|
If tenant is specified, the role is added just for that tenant,
|
||||||
otherwise the role is added globally.
|
otherwise the role is added globally.
|
||||||
@@ -72,7 +72,7 @@ class RoleManager(base.ManagerWithFind):
|
|||||||
return self._update(route % (user_id, role_id), None, "roles")
|
return self._update(route % (user_id, role_id), None, "roles")
|
||||||
|
|
||||||
def remove_user_role(self, user, role, tenant=None):
|
def remove_user_role(self, user, role, tenant=None):
|
||||||
"""Removes a role from a user.
|
"""Remove a role from a user.
|
||||||
|
|
||||||
If tenant is specified, the role is removed just for that tenant,
|
If tenant is specified, the role is removed just for that tenant,
|
||||||
otherwise the role is removed from the user's global roles.
|
otherwise the role is removed from the user's global roles.
|
||||||
|
@@ -117,7 +117,7 @@ class TokenManager(base.Manager):
|
|||||||
return access.AccessInfo.factory(auth_token=token_id, body=body)
|
return access.AccessInfo.factory(auth_token=token_id, body=body)
|
||||||
|
|
||||||
def get_revoked(self):
|
def get_revoked(self):
|
||||||
"""Returns the revoked tokens response.
|
"""Return the revoked tokens response.
|
||||||
|
|
||||||
The response will be a dict containing 'signed' which is a CMS-encoded
|
The response will be a dict containing 'signed' which is a CMS-encoded
|
||||||
document.
|
document.
|
||||||
|
@@ -58,7 +58,7 @@ class EndpointFilterManager(base.Manager):
|
|||||||
return super(EndpointFilterManager, self)._delete(url=base_url)
|
return super(EndpointFilterManager, self)._delete(url=base_url)
|
||||||
|
|
||||||
def check_endpoint_in_project(self, project, endpoint):
|
def check_endpoint_in_project(self, project, endpoint):
|
||||||
"""Checks if project-endpoint association exist."""
|
"""Check if project-endpoint association exist."""
|
||||||
if not (project and endpoint):
|
if not (project and endpoint):
|
||||||
raise ValueError(_('project and endpoint are required'))
|
raise ValueError(_('project and endpoint are required'))
|
||||||
|
|
||||||
|
@@ -49,7 +49,7 @@ class RoleAssignmentManager(base.CrudManager):
|
|||||||
def list(self, user=None, group=None, project=None, domain=None, role=None,
|
def list(self, user=None, group=None, project=None, domain=None, role=None,
|
||||||
effective=False, os_inherit_extension_inherited_to=None,
|
effective=False, os_inherit_extension_inherited_to=None,
|
||||||
include_subtree=False, include_names=False):
|
include_subtree=False, include_names=False):
|
||||||
"""Lists role assignments.
|
"""List role assignments.
|
||||||
|
|
||||||
If no arguments are provided, all role assignments in the
|
If no arguments are provided, all role assignments in the
|
||||||
system will be listed.
|
system will be listed.
|
||||||
|
@@ -137,7 +137,7 @@ class RoleManager(base.CrudManager):
|
|||||||
@positional(enforcement=positional.WARN)
|
@positional(enforcement=positional.WARN)
|
||||||
def list(self, user=None, group=None, domain=None,
|
def list(self, user=None, group=None, domain=None,
|
||||||
project=None, os_inherit_extension_inherited=False, **kwargs):
|
project=None, os_inherit_extension_inherited=False, **kwargs):
|
||||||
"""Lists roles and role grants.
|
"""List roles and role grants.
|
||||||
|
|
||||||
If no arguments are provided, all roles in the system will be
|
If no arguments are provided, all roles in the system will be
|
||||||
listed.
|
listed.
|
||||||
@@ -179,7 +179,7 @@ class RoleManager(base.CrudManager):
|
|||||||
@positional(enforcement=positional.WARN)
|
@positional(enforcement=positional.WARN)
|
||||||
def grant(self, role, user=None, group=None, domain=None, project=None,
|
def grant(self, role, user=None, group=None, domain=None, project=None,
|
||||||
os_inherit_extension_inherited=False, **kwargs):
|
os_inherit_extension_inherited=False, **kwargs):
|
||||||
"""Grants a role to a user or group on a domain or project.
|
"""Grant a role to a user or group on a domain or project.
|
||||||
|
|
||||||
If 'os_inherit_extension_inherited' is passed, then OS-INHERIT will be
|
If 'os_inherit_extension_inherited' is passed, then OS-INHERIT will be
|
||||||
used. It provides the ability for projects to inherit role assignments
|
used. It provides the ability for projects to inherit role assignments
|
||||||
@@ -200,7 +200,7 @@ class RoleManager(base.CrudManager):
|
|||||||
@positional(enforcement=positional.WARN)
|
@positional(enforcement=positional.WARN)
|
||||||
def check(self, role, user=None, group=None, domain=None, project=None,
|
def check(self, role, user=None, group=None, domain=None, project=None,
|
||||||
os_inherit_extension_inherited=False, **kwargs):
|
os_inherit_extension_inherited=False, **kwargs):
|
||||||
"""Checks if a user or group has a role on a domain or project.
|
"""Check if a user or group has a role on a domain or project.
|
||||||
|
|
||||||
If 'os_inherit_extension_inherited' is passed, then OS-INHERIT will be
|
If 'os_inherit_extension_inherited' is passed, then OS-INHERIT will be
|
||||||
used. It provides the ability for projects to inherit role assignments
|
used. It provides the ability for projects to inherit role assignments
|
||||||
@@ -223,7 +223,7 @@ class RoleManager(base.CrudManager):
|
|||||||
@positional(enforcement=positional.WARN)
|
@positional(enforcement=positional.WARN)
|
||||||
def revoke(self, role, user=None, group=None, domain=None, project=None,
|
def revoke(self, role, user=None, group=None, domain=None, project=None,
|
||||||
os_inherit_extension_inherited=False, **kwargs):
|
os_inherit_extension_inherited=False, **kwargs):
|
||||||
"""Revokes a role from a user or group on a domain or project.
|
"""Revoke a role from a user or group on a domain or project.
|
||||||
|
|
||||||
If 'os_inherit_extension_inherited' is passed, then OS-INHERIT will be
|
If 'os_inherit_extension_inherited' is passed, then OS-INHERIT will be
|
||||||
used. It provides the ability for projects to inherit role assignments
|
used. It provides the ability for projects to inherit role assignments
|
||||||
|
3
tox.ini
3
tox.ini
@@ -56,8 +56,7 @@ passenv = OS_*
|
|||||||
# D211: No blank lines allowed before class docstring
|
# D211: No blank lines allowed before class docstring
|
||||||
# D301: Use r”“” if any backslashes in a docstring
|
# D301: Use r”“” if any backslashes in a docstring
|
||||||
# D400: First line should end with a period.
|
# D400: First line should end with a period.
|
||||||
# D401: First line should be in imperative mood.
|
ignore = D100,D101,D102,D103,D104,D105,D200,D202,D203,D204,D205,D207,D208,D211,D301,D400
|
||||||
ignore = D100,D101,D102,D103,D104,D105,D200,D202,D203,D204,D205,D207,D208,D211,D301,D400,D401
|
|
||||||
show-source = True
|
show-source = True
|
||||||
exclude = .venv,.tox,dist,doc,*egg,build,*openstack/common*
|
exclude = .venv,.tox,dist,doc,*egg,build,*openstack/common*
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user