diff --git a/keystoneclient/base.py b/keystoneclient/base.py index ddd97fa68..803df1566 100644 --- a/keystoneclient/base.py +++ b/keystoneclient/base.py @@ -86,6 +86,7 @@ class Manager(object): :param client: instance of BaseClient descendant for HTTP requests """ + resource_class = None def __init__(self, client): @@ -293,6 +294,7 @@ class CrudManager(Manager): refer to an individual member of the collection. """ + collection_key = None key = None base_url = None diff --git a/keystoneclient/exceptions.py b/keystoneclient/exceptions.py index 83bf57a02..2e3270a88 100644 --- a/keystoneclient/exceptions.py +++ b/keystoneclient/exceptions.py @@ -52,21 +52,25 @@ An alias of :py:exc:`keystoneauth1.exceptions.auth.AuthorizationFailure` class ValidationError(ClientException): """Error in validation on API client side.""" + pass class UnsupportedVersion(ClientException): """User is trying to use an unsupported version of the API.""" + pass class CommandError(ClientException): """Error in CLI tool.""" + pass class AuthPluginOptionsMissing(AuthorizationFailure): """Auth plugin misses some options.""" + def __init__(self, opt_names): super(AuthPluginOptionsMissing, self).__init__( _("Authentication failed. Missing options: %s") % @@ -76,6 +80,7 @@ class AuthPluginOptionsMissing(AuthorizationFailure): class AuthSystemNotFound(AuthorizationFailure): """User has specified an AuthSystem that is not installed.""" + def __init__(self, auth_system): super(AuthSystemNotFound, self).__init__( _("AuthSystemNotFound: %r") % auth_system) @@ -84,6 +89,7 @@ class AuthSystemNotFound(AuthorizationFailure): class NoUniqueMatch(ClientException): """Multiple entities found instead of one.""" + pass @@ -102,6 +108,7 @@ An alias of :py:exc:`keystoneauth1.exceptions.catalog.EndpointNotFound` class AmbiguousEndpoints(EndpointException): """Found more than one matching endpoint in Service Catalog.""" + def __init__(self, endpoints=None): super(AmbiguousEndpoints, self).__init__( _("AmbiguousEndpoints: %r") % endpoints) @@ -132,6 +139,7 @@ An alias of :py:exc:`keystoneauth1.exceptions.http.HttpServerError` class HTTPRedirection(HttpError): """HTTP Redirection.""" + message = _("HTTP Redirection") @@ -353,6 +361,7 @@ HTTPError = HttpError class CertificateConfigError(Exception): """Error reading the certificate.""" + def __init__(self, output): self.output = output msg = _('Unable to load certificate.') @@ -361,6 +370,7 @@ class CertificateConfigError(Exception): class CMSError(Exception): """Error reading the certificate.""" + def __init__(self, output): self.output = output msg = _('Unable to sign or verify data.') diff --git a/keystoneclient/session.py b/keystoneclient/session.py index 4ebcba106..ebcf854c4 100644 --- a/keystoneclient/session.py +++ b/keystoneclient/session.py @@ -953,6 +953,7 @@ class TCPKeepAliveAdapter(requests.adapters.HTTPAdapter): disables Nagle's Algorithm. See also: http://blogs.msdn.com/b/windowsazurestorage/archive/2010/06/25/nagle-s-algorithm-is-not-friendly-towards-small-requests.aspx """ + def init_poolmanager(self, *args, **kwargs): if 'socket_options' not in kwargs: socket_options = [ diff --git a/keystoneclient/tests/unit/test_keyring.py b/keystoneclient/tests/unit/test_keyring.py index 2cd205de1..7d30d980c 100644 --- a/keystoneclient/tests/unit/test_keyring.py +++ b/keystoneclient/tests/unit/test_keyring.py @@ -54,6 +54,7 @@ class KeyringTest(utils.TestCase): setting password, and allows easy password and key retrieval. Also records if a password was retrieved. """ + def __init__(self): self.key = None self.password = None diff --git a/keystoneclient/v2_0/endpoints.py b/keystoneclient/v2_0/endpoints.py index 984be33e8..0f98c6c94 100644 --- a/keystoneclient/v2_0/endpoints.py +++ b/keystoneclient/v2_0/endpoints.py @@ -18,6 +18,7 @@ from keystoneclient import base class Endpoint(base.Resource): """Represents a Keystone endpoint.""" + def __repr__(self): return "" % self._info diff --git a/keystoneclient/v2_0/extensions.py b/keystoneclient/v2_0/extensions.py index b805d31de..6e772afae 100644 --- a/keystoneclient/v2_0/extensions.py +++ b/keystoneclient/v2_0/extensions.py @@ -15,6 +15,7 @@ from keystoneclient import base class Extension(base.Resource): """Represents an Identity API extension.""" + def __repr__(self): return "" % self._info diff --git a/keystoneclient/v2_0/roles.py b/keystoneclient/v2_0/roles.py index d0d43a8b9..bdda53c6b 100644 --- a/keystoneclient/v2_0/roles.py +++ b/keystoneclient/v2_0/roles.py @@ -19,6 +19,7 @@ from keystoneclient import base class Role(base.Resource): """Represents a Keystone role.""" + def __repr__(self): return "" % self._info @@ -28,6 +29,7 @@ class Role(base.Resource): class RoleManager(base.ManagerWithFind): """Manager class for manipulating Keystone roles.""" + resource_class = Role def get(self, role): diff --git a/keystoneclient/v2_0/services.py b/keystoneclient/v2_0/services.py index 4e6d3af95..7a64f7497 100644 --- a/keystoneclient/v2_0/services.py +++ b/keystoneclient/v2_0/services.py @@ -19,12 +19,14 @@ from keystoneclient import base class Service(base.Resource): """Represents a Keystone service.""" + def __repr__(self): return "" % self._info class ServiceManager(base.ManagerWithFind): """Manager class for manipulating Keystone services.""" + resource_class = Service def list(self): diff --git a/keystoneclient/v2_0/tenants.py b/keystoneclient/v2_0/tenants.py index 2c95ae15b..a78a81fc5 100644 --- a/keystoneclient/v2_0/tenants.py +++ b/keystoneclient/v2_0/tenants.py @@ -32,6 +32,7 @@ class Tenant(base.Resource): * enabled: boolean to indicate if tenant is enabled """ + def __repr__(self): return "" % self._info @@ -72,6 +73,7 @@ class Tenant(base.Resource): class TenantManager(base.ManagerWithFind): """Manager class for manipulating Keystone tenants.""" + resource_class = Tenant def __init__(self, client, role_manager, user_manager): diff --git a/keystoneclient/v2_0/users.py b/keystoneclient/v2_0/users.py index e62c24477..77f24f374 100644 --- a/keystoneclient/v2_0/users.py +++ b/keystoneclient/v2_0/users.py @@ -21,6 +21,7 @@ from keystoneclient import base class User(base.Resource): """Represents a Keystone user.""" + def __repr__(self): return "" % self._info @@ -33,6 +34,7 @@ class User(base.Resource): class UserManager(base.ManagerWithFind): """Manager class for manipulating Keystone users.""" + resource_class = User def __init__(self, client, role_manager): diff --git a/keystoneclient/v3/auth.py b/keystoneclient/v3/auth.py index 121891ba0..c228586f7 100644 --- a/keystoneclient/v3/auth.py +++ b/keystoneclient/v3/auth.py @@ -39,6 +39,7 @@ class Domain(base.Resource): * id: a uuid that identifies the domain """ + pass diff --git a/keystoneclient/v3/client.py b/keystoneclient/v3/client.py index d3b2a2483..619de6071 100644 --- a/keystoneclient/v3/client.py +++ b/keystoneclient/v3/client.py @@ -123,12 +123,12 @@ class Client(httpclient.HTTPClient): .. py:attribute:: endpoint_filter :py:class:`keystoneclient.v3.contrib.endpoint_filter.\ -EndpointFilterManager` + EndpointFilterManager` .. py:attribute:: endpoint_policy :py:class:`keystoneclient.v3.contrib.endpoint_policy.\ -EndpointPolicyManager` + EndpointPolicyManager` .. py:attribute:: endpoints diff --git a/keystoneclient/v3/contrib/endpoint_filter.py b/keystoneclient/v3/contrib/endpoint_filter.py index 5e50da7af..586a74a62 100644 --- a/keystoneclient/v3/contrib/endpoint_filter.py +++ b/keystoneclient/v3/contrib/endpoint_filter.py @@ -21,6 +21,7 @@ from keystoneclient.v3 import projects class EndpointFilterManager(base.Manager): """Manager class for manipulating project-endpoint associations.""" + OS_EP_FILTER_EXT = '/OS-EP-FILTER' def _build_base_url(self, project=None, endpoint=None): diff --git a/keystoneclient/v3/contrib/federation/base.py b/keystoneclient/v3/contrib/federation/base.py index 0160170ea..6c095e7c1 100644 --- a/keystoneclient/v3/contrib/federation/base.py +++ b/keystoneclient/v3/contrib/federation/base.py @@ -22,6 +22,7 @@ from keystoneclient import exceptions @six.add_metaclass(abc.ABCMeta) class EntityManager(base.Manager): """Manager class for listing federated accessible objects.""" + resource_class = None @abc.abstractproperty diff --git a/keystoneclient/v3/contrib/federation/identity_providers.py b/keystoneclient/v3/contrib/federation/identity_providers.py index e21a136fa..85c4a73ff 100644 --- a/keystoneclient/v3/contrib/federation/identity_providers.py +++ b/keystoneclient/v3/contrib/federation/identity_providers.py @@ -22,6 +22,7 @@ class IdentityProvider(base.Resource): * id: user-defined unique string identifying Identity Provider. """ + pass diff --git a/keystoneclient/v3/contrib/federation/mappings.py b/keystoneclient/v3/contrib/federation/mappings.py index 7e8293139..0a46789e6 100644 --- a/keystoneclient/v3/contrib/federation/mappings.py +++ b/keystoneclient/v3/contrib/federation/mappings.py @@ -22,6 +22,7 @@ class Mapping(base.Resource): * id: user defined unique string identifying mapping. """ + pass diff --git a/keystoneclient/v3/contrib/federation/protocols.py b/keystoneclient/v3/contrib/federation/protocols.py index cbec448b5..7e2d46f93 100644 --- a/keystoneclient/v3/contrib/federation/protocols.py +++ b/keystoneclient/v3/contrib/federation/protocols.py @@ -23,6 +23,7 @@ class Protocol(base.Resource): federation protocol. """ + pass diff --git a/keystoneclient/v3/contrib/federation/service_providers.py b/keystoneclient/v3/contrib/federation/service_providers.py index 17d458f01..f731c394e 100644 --- a/keystoneclient/v3/contrib/federation/service_providers.py +++ b/keystoneclient/v3/contrib/federation/service_providers.py @@ -24,6 +24,7 @@ class ServiceProvider(base.Resource): * auth_url: the authentication url of Service Provider. """ + pass diff --git a/keystoneclient/v3/contrib/oauth1/access_tokens.py b/keystoneclient/v3/contrib/oauth1/access_tokens.py index d45bf3f9f..b2d0e31d6 100644 --- a/keystoneclient/v3/contrib/oauth1/access_tokens.py +++ b/keystoneclient/v3/contrib/oauth1/access_tokens.py @@ -29,6 +29,7 @@ class AccessToken(base.Resource): class AccessTokenManager(base.CrudManager): """Manager class for manipulating identity OAuth access tokens.""" + resource_class = AccessToken def create(self, consumer_key, consumer_secret, request_key, diff --git a/keystoneclient/v3/contrib/oauth1/consumers.py b/keystoneclient/v3/contrib/oauth1/consumers.py index 25e8ca191..5c81ff47f 100644 --- a/keystoneclient/v3/contrib/oauth1/consumers.py +++ b/keystoneclient/v3/contrib/oauth1/consumers.py @@ -22,11 +22,13 @@ class Consumer(base.Resource): * id: a uuid that identifies the consumer * description: a short description of the consumer """ + pass class ConsumerManager(base.CrudManager): """Manager class for manipulating identity consumers.""" + resource_class = Consumer collection_key = 'consumers' key = 'consumer' diff --git a/keystoneclient/v3/contrib/oauth1/request_tokens.py b/keystoneclient/v3/contrib/oauth1/request_tokens.py index 27f79c11f..5d60bed8b 100644 --- a/keystoneclient/v3/contrib/oauth1/request_tokens.py +++ b/keystoneclient/v3/contrib/oauth1/request_tokens.py @@ -38,6 +38,7 @@ class RequestToken(base.Resource): class RequestTokenManager(base.CrudManager): """Manager class for manipulating identity OAuth request tokens.""" + resource_class = RequestToken def authorize(self, request_token, roles): diff --git a/keystoneclient/v3/contrib/trusts.py b/keystoneclient/v3/contrib/trusts.py index 1b3033cee..e23618890 100644 --- a/keystoneclient/v3/contrib/trusts.py +++ b/keystoneclient/v3/contrib/trusts.py @@ -26,11 +26,13 @@ class Trust(base.Resource): * trustee_user_id: a uuid that identifies the trustee * trustor_user_id: a uuid that identifies the trustor """ + pass class TrustManager(base.CrudManager): """Manager class for manipulating Trusts.""" + resource_class = Trust collection_key = 'trusts' key = 'trust' diff --git a/keystoneclient/v3/credentials.py b/keystoneclient/v3/credentials.py index 14e891eab..28e1e08f3 100644 --- a/keystoneclient/v3/credentials.py +++ b/keystoneclient/v3/credentials.py @@ -32,11 +32,13 @@ class Credential(base.Resource): * project_id: project ID (optional) """ + pass class CredentialManager(base.CrudManager): """Manager class for manipulating Identity credentials.""" + resource_class = Credential collection_key = 'credentials' key = 'credential' diff --git a/keystoneclient/v3/domains.py b/keystoneclient/v3/domains.py index 7b6c4a176..466343f8b 100644 --- a/keystoneclient/v3/domains.py +++ b/keystoneclient/v3/domains.py @@ -26,11 +26,13 @@ class Domain(base.Resource): * id: a uuid that identifies the domain """ + pass class DomainManager(base.CrudManager): """Manager class for manipulating Identity domains.""" + resource_class = Domain collection_key = 'domains' key = 'domain' diff --git a/keystoneclient/v3/endpoints.py b/keystoneclient/v3/endpoints.py index 1be1e22be..e24ffaae5 100644 --- a/keystoneclient/v3/endpoints.py +++ b/keystoneclient/v3/endpoints.py @@ -36,11 +36,13 @@ class Endpoint(base.Resource): * enabled: determines whether the endpoint appears in the catalog """ + pass class EndpointManager(base.CrudManager): """Manager class for manipulating Identity endpoints.""" + resource_class = Endpoint collection_key = 'endpoints' key = 'endpoint' diff --git a/keystoneclient/v3/groups.py b/keystoneclient/v3/groups.py index 28e80d5b4..654ec349d 100644 --- a/keystoneclient/v3/groups.py +++ b/keystoneclient/v3/groups.py @@ -28,6 +28,7 @@ class Group(base.Resource): * description: group description """ + @positional(enforcement=positional.WARN) def update(self, name=None, description=None): kwargs = { @@ -48,6 +49,7 @@ class Group(base.Resource): class GroupManager(base.CrudManager): """Manager class for manipulating Identity groups.""" + resource_class = Group collection_key = 'groups' key = 'group' diff --git a/keystoneclient/v3/policies.py b/keystoneclient/v3/policies.py index 661726dc2..9ab538756 100644 --- a/keystoneclient/v3/policies.py +++ b/keystoneclient/v3/policies.py @@ -28,6 +28,7 @@ class Policy(base.Resource): * type: the mime type of the policy blob """ + @positional(enforcement=positional.WARN) def update(self, blob=None, type=None): kwargs = { @@ -46,6 +47,7 @@ class Policy(base.Resource): class PolicyManager(base.CrudManager): """Manager class for manipulating Identity policies.""" + resource_class = Policy collection_key = 'policies' key = 'policy' diff --git a/keystoneclient/v3/projects.py b/keystoneclient/v3/projects.py index 0f529800d..43d6d57df 100644 --- a/keystoneclient/v3/projects.py +++ b/keystoneclient/v3/projects.py @@ -36,6 +36,7 @@ class Project(base.Resource): project in the hierarchy """ + @positional(enforcement=positional.WARN) def update(self, name=None, description=None, enabled=None): kwargs = { @@ -57,6 +58,7 @@ class Project(base.Resource): class ProjectManager(base.CrudManager): """Manager class for manipulating Identity projects.""" + resource_class = Project collection_key = 'projects' key = 'project' diff --git a/keystoneclient/v3/regions.py b/keystoneclient/v3/regions.py index f9b621fcf..dcf2bbe51 100644 --- a/keystoneclient/v3/regions.py +++ b/keystoneclient/v3/regions.py @@ -25,11 +25,13 @@ class Region(base.Resource): * enabled: determines whether the endpoint appears in the catalog. Defaults to True """ + pass class RegionManager(base.CrudManager): """Manager class for manipulating Identity regions.""" + resource_class = Region collection_key = 'regions' key = 'region' diff --git a/keystoneclient/v3/role_assignments.py b/keystoneclient/v3/role_assignments.py index 71ae2c25e..460280035 100644 --- a/keystoneclient/v3/role_assignments.py +++ b/keystoneclient/v3/role_assignments.py @@ -25,11 +25,13 @@ class RoleAssignment(base.Resource): * scope: an object which has either a project or domain object containing an uuid """ + pass class RoleAssignmentManager(base.CrudManager): """Manager class for manipulating Identity roles assignments.""" + resource_class = RoleAssignment collection_key = 'role_assignments' key = 'role_assignment' diff --git a/keystoneclient/v3/roles.py b/keystoneclient/v3/roles.py index bb77e3b5e..6d6b71820 100644 --- a/keystoneclient/v3/roles.py +++ b/keystoneclient/v3/roles.py @@ -30,6 +30,7 @@ class Role(base.Resource): * domain: optional domain for the role """ + pass @@ -41,11 +42,13 @@ class InferenceRule(base.Resource): * implied_role: this role is implied by the other """ + pass class RoleManager(base.CrudManager): """Manager class for manipulating Identity roles.""" + resource_class = Role collection_key = 'roles' key = 'role' diff --git a/keystoneclient/v3/services.py b/keystoneclient/v3/services.py index c2b7aeba9..02f88e807 100644 --- a/keystoneclient/v3/services.py +++ b/keystoneclient/v3/services.py @@ -29,11 +29,13 @@ class Service(base.Resource): * enabled: determines whether the service appears in the catalog """ + pass class ServiceManager(base.CrudManager): """Manager class for manipulating Identity services.""" + resource_class = Service collection_key = 'services' key = 'service' diff --git a/keystoneclient/v3/users.py b/keystoneclient/v3/users.py index 89c529d41..93fd7d4ce 100644 --- a/keystoneclient/v3/users.py +++ b/keystoneclient/v3/users.py @@ -33,11 +33,13 @@ class User(base.Resource): * id: a uuid that identifies the user """ + pass class UserManager(base.CrudManager): """Manager class for manipulating Identity users.""" + resource_class = User collection_key = 'users' key = 'user' diff --git a/tox.ini b/tox.ini index 16d7a5f0e..cd26e8f56 100644 --- a/tox.ini +++ b/tox.ini @@ -49,10 +49,7 @@ passenv = OS_* # D200: One-line docstring should fit on one line with quotes # D202: No blank lines allowed after function docstring # D203: 1 blank required before class docstring. -# D204: 1 blank required after class docstring -# D205: Blank line required between one-line summary and description. -# D207: Docstring is under-indented -ignore = D100,D101,D102,D103,D104,D105,D200,D202,D203,D204,D205,D207 +ignore = D100,D101,D102,D103,D104,D105,D200,D202,D203 show-source = True exclude = .venv,.tox,dist,doc,*egg,build,*openstack/common*