diff options
Diffstat (limited to 'keystoneclient/v3')
-rw-r--r-- | keystoneclient/v3/client.py | 14 | ||||
-rw-r--r-- | keystoneclient/v3/contrib/endpoint_filter.py | 13 | ||||
-rw-r--r-- | keystoneclient/v3/contrib/endpoint_policy.py | 11 | ||||
-rw-r--r-- | keystoneclient/v3/contrib/oauth1/core.py | 3 | ||||
-rw-r--r-- | keystoneclient/v3/contrib/trusts.py | 5 | ||||
-rw-r--r-- | keystoneclient/v3/credentials.py | 3 | ||||
-rw-r--r-- | keystoneclient/v3/endpoints.py | 3 | ||||
-rw-r--r-- | keystoneclient/v3/role_assignments.py | 29 | ||||
-rw-r--r-- | keystoneclient/v3/roles.py | 9 | ||||
-rw-r--r-- | keystoneclient/v3/users.py | 19 |
10 files changed, 60 insertions, 49 deletions
diff --git a/keystoneclient/v3/client.py b/keystoneclient/v3/client.py index 1967e8e..662629c 100644 --- a/keystoneclient/v3/client.py +++ b/keystoneclient/v3/client.py @@ -20,6 +20,7 @@ from oslo.serialization import jsonutils from keystoneclient.auth.identity import v3 as v3_auth from keystoneclient import exceptions from keystoneclient import httpclient +from keystoneclient.i18n import _ from keystoneclient.v3.contrib import endpoint_filter from keystoneclient.v3.contrib import endpoint_policy from keystoneclient.v3.contrib import federation @@ -203,7 +204,7 @@ EndpointPolicyManager` if self.auth_ref.domain_scoped: if not self.auth_ref.domain_id: raise exceptions.AuthorizationFailure( - "Token didn't provide domain_id") + _("Token didn't provide domain_id")) self._process_management_url(kwargs.get('region_name')) self.domain_name = self.auth_ref.domain_name self.domain_id = self.auth_ref.domain_id @@ -235,7 +236,7 @@ EndpointPolicyManager` """ try: if auth_url is None: - raise ValueError("Cannot authenticate without an auth_url") + raise ValueError(_("Cannot authenticate without an auth_url")) auth_methods = [] @@ -251,7 +252,7 @@ EndpointPolicyManager` auth_methods.append(m) if not auth_methods: - msg = 'A user and password or token is required.' + msg = _('A user and password or token is required.') raise exceptions.AuthorizationFailure(msg) plugin = v3_auth.Auth(auth_url, auth_methods, @@ -268,8 +269,9 @@ EndpointPolicyManager` _logger.debug('Authorization failed.') raise except exceptions.EndpointNotFound: - msg = 'There was no suitable authentication url for this request' + msg = _('There was no suitable authentication url for this' + ' request') raise exceptions.AuthorizationFailure(msg) except Exception as e: - raise exceptions.AuthorizationFailure('Authorization failed: ' - '%s' % e) + raise exceptions.AuthorizationFailure( + _('Authorization failed: %s') % e) diff --git a/keystoneclient/v3/contrib/endpoint_filter.py b/keystoneclient/v3/contrib/endpoint_filter.py index c0a1eef..3e3b7ef 100644 --- a/keystoneclient/v3/contrib/endpoint_filter.py +++ b/keystoneclient/v3/contrib/endpoint_filter.py @@ -14,6 +14,7 @@ from keystoneclient import base from keystoneclient import exceptions +from keystoneclient.i18n import _ class EndpointFilterManager(base.Manager): @@ -31,7 +32,7 @@ class EndpointFilterManager(base.Manager): elif endpoint_id: api_path = '/endpoints/%s/projects' % (endpoint_id) else: - msg = 'Must specify a project, an endpoint, or both' + msg = _('Must specify a project, an endpoint, or both') raise exceptions.ValidationError(msg) return self.OS_EP_FILTER_EXT + api_path @@ -39,7 +40,7 @@ class EndpointFilterManager(base.Manager): def add_endpoint_to_project(self, project, endpoint): """Create a project-endpoint association.""" if not (project and endpoint): - raise ValueError('project and endpoint are required') + raise ValueError(_('project and endpoint are required')) base_url = self._build_base_url(project=project, endpoint=endpoint) @@ -48,7 +49,7 @@ class EndpointFilterManager(base.Manager): def delete_endpoint_from_project(self, project, endpoint): """Remove a project-endpoint association.""" if not (project and endpoint): - raise ValueError('project and endpoint are required') + raise ValueError(_('project and endpoint are required')) base_url = self._build_base_url(project=project, endpoint=endpoint) @@ -57,7 +58,7 @@ class EndpointFilterManager(base.Manager): def check_endpoint_in_project(self, project, endpoint): """Checks if project-endpoint association exist.""" if not (project and endpoint): - raise ValueError('project and endpoint are required') + raise ValueError(_('project and endpoint are required')) base_url = self._build_base_url(project=project, endpoint=endpoint) @@ -66,7 +67,7 @@ class EndpointFilterManager(base.Manager): def list_endpoints_for_project(self, project): """List all endpoints for a given project.""" if not project: - raise ValueError('project is required') + raise ValueError(_('project is required')) base_url = self._build_base_url(project=project) return super(EndpointFilterManager, self)._list( @@ -77,7 +78,7 @@ class EndpointFilterManager(base.Manager): def list_projects_for_endpoint(self, endpoint): """List all projects for a given endpoint.""" if not endpoint: - raise ValueError('endpoint is required') + raise ValueError(_('endpoint is required')) base_url = self._build_base_url(endpoint=endpoint) return super(EndpointFilterManager, self)._list( diff --git a/keystoneclient/v3/contrib/endpoint_policy.py b/keystoneclient/v3/contrib/endpoint_policy.py index 9d4d997..c473ad6 100644 --- a/keystoneclient/v3/contrib/endpoint_policy.py +++ b/keystoneclient/v3/contrib/endpoint_policy.py @@ -13,6 +13,7 @@ # under the License. from keystoneclient import base +from keystoneclient.i18n import _ from keystoneclient.v3 import policies @@ -24,7 +25,7 @@ class EndpointPolicyManager(base.Manager): def _act_on_policy_association_for_endpoint( self, policy, endpoint, action): if not (policy and endpoint): - raise ValueError('policy and endpoint are required') + raise ValueError(_('policy and endpoint are required')) policy_id = base.getid(policy) endpoint_id = base.getid(endpoint) @@ -52,7 +53,7 @@ class EndpointPolicyManager(base.Manager): def _act_on_policy_association_for_service(self, policy, service, action): if not (policy and service): - raise ValueError('policy and service are required') + raise ValueError(_('policy and service are required')) policy_id = base.getid(policy) service_id = base.getid(service) @@ -81,7 +82,7 @@ class EndpointPolicyManager(base.Manager): def _act_on_policy_association_for_region_and_service( self, policy, region, service, action): if not (policy and region and service): - raise ValueError('policy, region and service are required') + raise ValueError(_('policy, region and service are required')) policy_id = base.getid(policy) region_id = base.getid(region) @@ -121,7 +122,7 @@ class EndpointPolicyManager(base.Manager): """ if not endpoint: - raise ValueError('endpoint is required') + raise ValueError(_('endpoint is required')) endpoint_id = base.getid(endpoint) url = ('/endpoints/%(endpoint_id)s/%(ext_name)s/policy') % { @@ -141,7 +142,7 @@ class EndpointPolicyManager(base.Manager): """ if not policy: - raise ValueError('policy is required') + raise ValueError(_('policy is required')) policy_id = base.getid(policy) url = ('/policies/%(policy_id)s/%(ext_name)s/endpoints') % { diff --git a/keystoneclient/v3/contrib/oauth1/core.py b/keystoneclient/v3/contrib/oauth1/core.py index 36823f0..8d10325 100644 --- a/keystoneclient/v3/contrib/oauth1/core.py +++ b/keystoneclient/v3/contrib/oauth1/core.py @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +from keystoneclient.i18n import _ from keystoneclient.v3.contrib.oauth1 import access_tokens from keystoneclient.v3.contrib.oauth1 import consumers from keystoneclient.v3.contrib.oauth1 import request_tokens @@ -59,6 +60,6 @@ class OAuthManagerOptionalImportProxy(object): def __getattribute__(self, name): if name in ('access_tokens', 'consumers', 'request_tokens'): raise NotImplementedError( - 'To use %r oauthlib must be installed' % name) + _('To use %r oauthlib must be installed') % name) return super(OAuthManagerOptionalImportProxy, self).__getattribute__(name) diff --git a/keystoneclient/v3/contrib/trusts.py b/keystoneclient/v3/contrib/trusts.py index 70e9d8e..0fb75ca 100644 --- a/keystoneclient/v3/contrib/trusts.py +++ b/keystoneclient/v3/contrib/trusts.py @@ -14,6 +14,7 @@ from oslo.utils import timeutils from keystoneclient import base from keystoneclient import exceptions +from keystoneclient.i18n import _ class Trust(base.Resource): @@ -75,8 +76,8 @@ class TrustManager(base.CrudManager): **kwargs) def update(self): - raise exceptions.MethodNotImplemented('Update not supported' - ' for trusts') + raise exceptions.MethodNotImplemented( + _('Update not supported for trusts')) def list(self, trustee_user=None, trustor_user=None, **kwargs): """List Trusts.""" diff --git a/keystoneclient/v3/credentials.py b/keystoneclient/v3/credentials.py index be28cc5..833a32f 100644 --- a/keystoneclient/v3/credentials.py +++ b/keystoneclient/v3/credentials.py @@ -15,6 +15,7 @@ # under the License. from keystoneclient import base +from keystoneclient.i18n import _ from keystoneclient import utils @@ -46,7 +47,7 @@ class CredentialManager(base.CrudManager): return data else: raise ValueError( - "Credential requires blob to be specified") + _("Credential requires blob to be specified")) @utils.positional(1, enforcement=utils.positional.WARN) def create(self, user, type, blob=None, data=None, project=None, **kwargs): diff --git a/keystoneclient/v3/endpoints.py b/keystoneclient/v3/endpoints.py index 3f9dfbd..eeddc4c 100644 --- a/keystoneclient/v3/endpoints.py +++ b/keystoneclient/v3/endpoints.py @@ -16,6 +16,7 @@ from keystoneclient import base from keystoneclient import exceptions +from keystoneclient.i18n import _ from keystoneclient import utils @@ -45,7 +46,7 @@ class EndpointManager(base.CrudManager): def _validate_interface(self, interface): if interface is not None and interface not in VALID_INTERFACES: - msg = '"interface" must be one of: %s' + msg = _('"interface" must be one of: %s') msg = msg % ', '.join(VALID_INTERFACES) raise exceptions.ValidationError(msg) diff --git a/keystoneclient/v3/role_assignments.py b/keystoneclient/v3/role_assignments.py index 5394c3d..6518e43 100644 --- a/keystoneclient/v3/role_assignments.py +++ b/keystoneclient/v3/role_assignments.py @@ -12,6 +12,7 @@ from keystoneclient import base from keystoneclient import exceptions +from keystoneclient.i18n import _ class RoleAssignment(base.Resource): @@ -37,12 +38,12 @@ class RoleAssignmentManager(base.CrudManager): def _check_not_user_and_group(self, user, group): if user and group: - msg = 'Specify either a user or group, not both' + msg = _('Specify either a user or group, not both') raise exceptions.ValidationError(msg) def _check_not_domain_and_project(self, domain, project): if domain and project: - msg = 'Specify either a domain or project, not both' + msg = _('Specify either a domain or project, not both') raise exceptions.ValidationError(msg) def list(self, user=None, group=None, project=None, domain=None, role=None, @@ -87,25 +88,25 @@ class RoleAssignmentManager(base.CrudManager): return super(RoleAssignmentManager, self).list(**query_params) def create(self, **kwargs): - raise exceptions.MethodNotImplemented('Create not supported for' - ' role assignments') + raise exceptions.MethodNotImplemented( + _('Create not supported for role assignments')) def update(self, **kwargs): - raise exceptions.MethodNotImplemented('Update not supported for' - ' role assignments') + raise exceptions.MethodNotImplemented( + _('Update not supported for role assignments')) def get(self, **kwargs): - raise exceptions.MethodNotImplemented('Get not supported for' - ' role assignments') + raise exceptions.MethodNotImplemented( + _('Get not supported for role assignments')) def find(self, **kwargs): - raise exceptions.MethodNotImplemented('Find not supported for' - ' role assignments') + raise exceptions.MethodNotImplemented( + _('Find not supported for role assignments')) def put(self, **kwargs): - raise exceptions.MethodNotImplemented('Put not supported for' - ' role assignments') + raise exceptions.MethodNotImplemented( + _('Put not supported for role assignments')) def delete(self, **kwargs): - raise exceptions.MethodNotImplemented('Delete not supported for' - ' role assignments') + raise exceptions.MethodNotImplemented( + _('Delete not supported for role assignments')) diff --git a/keystoneclient/v3/roles.py b/keystoneclient/v3/roles.py index 40c624a..3eb68d1 100644 --- a/keystoneclient/v3/roles.py +++ b/keystoneclient/v3/roles.py @@ -16,6 +16,7 @@ from keystoneclient import base from keystoneclient import exceptions +from keystoneclient.i18n import _ from keystoneclient import utils @@ -59,18 +60,18 @@ class RoleManager(base.CrudManager): def _require_domain_xor_project(self, domain, project): if domain and project: - msg = 'Specify either a domain or project, not both' + msg = _('Specify either a domain or project, not both') raise exceptions.ValidationError(msg) elif not (domain or project): - msg = 'Must specify either a domain or project' + msg = _('Must specify either a domain or project') raise exceptions.ValidationError(msg) def _require_user_xor_group(self, user, group): if user and group: - msg = 'Specify either a user or group, not both' + msg = _('Specify either a user or group, not both') raise exceptions.ValidationError(msg) elif not (user or group): - msg = 'Must specify either a user or group' + msg = _('Must specify either a user or group') raise exceptions.ValidationError(msg) @utils.positional(1, enforcement=utils.positional.WARN) diff --git a/keystoneclient/v3/users.py b/keystoneclient/v3/users.py index 140c785..3343d50 100644 --- a/keystoneclient/v3/users.py +++ b/keystoneclient/v3/users.py @@ -18,6 +18,7 @@ import logging from keystoneclient import base from keystoneclient import exceptions +from keystoneclient.i18n import _, _LW from keystoneclient import utils LOG = logging.getLogger(__name__) @@ -41,7 +42,7 @@ class UserManager(base.CrudManager): def _require_user_and_group(self, user, group): if not (user and group): - msg = 'Specify both a user and a group' + msg = _('Specify both a user and a group') raise exceptions.ValidationError(msg) @utils.positional(1, enforcement=utils.positional.WARN) @@ -58,8 +59,8 @@ class UserManager(base.CrudManager): will be used. """ if project: - LOG.warning("The project argument is deprecated, " - "use default_project instead.") + LOG.warning(_LW("The project argument is deprecated, " + "use default_project instead.")) default_project_id = base.getid(default_project) or base.getid(project) user_data = base.filter_none(name=name, domain_id=base.getid(domain), @@ -92,8 +93,8 @@ class UserManager(base.CrudManager): will be used. """ if project: - LOG.warning("The project argument is deprecated, " - "use default_project instead.") + LOG.warning(_LW("The project argument is deprecated, " + "use default_project instead.")) default_project_id = base.getid(default_project) or base.getid(project) if group: base_url = '/groups/%s' % base.getid(group) @@ -124,8 +125,8 @@ class UserManager(base.CrudManager): will be used. """ if project: - LOG.warning("The project argument is deprecated, " - "use default_project instead.") + LOG.warning(_LW("The project argument is deprecated, " + "use default_project instead.")) default_project_id = base.getid(default_project) or base.getid(project) user_data = base.filter_none(name=name, domain_id=base.getid(domain), @@ -145,11 +146,11 @@ class UserManager(base.CrudManager): def update_password(self, old_password, new_password): """Update the password for the user the token belongs to.""" if not (old_password and new_password): - msg = 'Specify both the current password and a new password' + msg = _('Specify both the current password and a new password') raise exceptions.ValidationError(msg) if old_password == new_password: - msg = 'Old password and new password must be different.' + msg = _('Old password and new password must be different.') raise exceptions.ValidationError(msg) params = {'user': {'password': new_password, |