From da4d4a1035b688bbb7e7065c792b29978bfafc1f Mon Sep 17 00:00:00 2001 From: Priti Desai Date: Tue, 8 Apr 2014 23:02:59 +0000 Subject: [PATCH] Adding more descriptive error message Keystone Trusts API sends non descriptive error message for requests with invalid trust id. The error message only contains invalid_trust_id instead of printing: "Could not find trust: invalid_trust_id" Setting kwarg "trust_id" in the exception. Closes-Bug: #1305272 Change-Id: I35cab35ab90cf66ce7124dea142013bec9eefda9 --- keystone/trust/controllers.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/keystone/trust/controllers.py b/keystone/trust/controllers.py index f698771da3..e4e7da515e 100644 --- a/keystone/trust/controllers.py +++ b/keystone/trust/controllers.py @@ -73,7 +73,7 @@ class TrustV3(controller.V3Controller): user_id = self._get_user_id(context) trust = self.trust_api.get_trust(trust_id) if not trust: - raise exception.TrustNotFound(trust_id) + raise exception.TrustNotFound(trust_id=trust_id) _trustor_trustee_only(trust, user_id) self._fill_in_roles(context, trust, self.assignment_api.list_roles()) @@ -214,7 +214,7 @@ class TrustV3(controller.V3Controller): def delete_trust(self, context, trust_id): trust = self.trust_api.get_trust(trust_id) if not trust: - raise exception.TrustNotFound(trust_id) + raise exception.TrustNotFound(trust_id=trust_id) user_id = self._get_user_id(context) _admin_trustor_only(context, trust, user_id) @@ -226,7 +226,7 @@ class TrustV3(controller.V3Controller): def list_roles_for_trust(self, context, trust_id): trust = self.get_trust(context, trust_id)['trust'] if not trust: - raise exception.TrustNotFound(trust_id) + raise exception.TrustNotFound(trust_id=trust_id) user_id = self._get_user_id(context) _trustor_trustee_only(trust, user_id) return {'roles': trust['roles'], @@ -237,7 +237,7 @@ class TrustV3(controller.V3Controller): """Checks if a role has been assigned to a trust.""" trust = self.trust_api.get_trust(trust_id) if not trust: - raise exception.TrustNotFound(trust_id) + raise exception.TrustNotFound(trust_id=trust_id) user_id = self._get_user_id(context) _trustor_trustee_only(trust, user_id) if not any(role['id'] == role_id for role in trust['roles']):