From 2e7b4f2027a1147ca28301e4f88adf8274b39a1f Mon Sep 17 00:00:00 2001 From: DUVAL Thomas Date: Thu, 9 Jun 2016 09:11:50 +0200 Subject: Update Keystone core to Mitaka. Change-Id: Ia10d6add16f4a9d25d1f42d420661c46332e69db --- keystone-moon/keystone/trust/core.py | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) (limited to 'keystone-moon/keystone/trust/core.py') diff --git a/keystone-moon/keystone/trust/core.py b/keystone-moon/keystone/trust/core.py index 7838cb03..43069deb 100644 --- a/keystone-moon/keystone/trust/core.py +++ b/keystone-moon/keystone/trust/core.py @@ -17,7 +17,6 @@ import abc from oslo_config import cfg -from oslo_log import log import six from six.moves import zip @@ -30,8 +29,6 @@ from keystone import notifications CONF = cfg.CONF -LOG = log.getLogger(__name__) - @dependency.requires('identity_api') @dependency.provider('trust_api') @@ -93,14 +90,9 @@ class Manager(manager.Manager): def get_trust_pedigree(self, trust_id): trust = self.driver.get_trust(trust_id) trust_chain = [trust] - if trust and trust.get('redelegated_trust_id'): - trusts = self.driver.list_trusts_for_trustor( - trust['trustor_user_id']) - while trust_chain[-1].get('redelegated_trust_id'): - for t in trusts: - if t['id'] == trust_chain[-1]['redelegated_trust_id']: - trust_chain.append(t) - break + while trust and trust.get('redelegated_trust_id'): + trust = self.driver.get_trust(trust['redelegated_trust_id']) + trust_chain.append(trust) return trust_chain @@ -179,7 +171,7 @@ class Manager(manager.Manager): def delete_trust(self, trust_id, initiator=None): """Remove a trust. - :raises: keystone.exception.TrustNotFound + :raises keystone.exception.TrustNotFound: If the trust doesn't exist. Recursively remove given and redelegated trusts """ @@ -192,7 +184,7 @@ class Manager(manager.Manager): # recursive call to make sure all notifications are sent try: self.delete_trust(t['id']) - except exception.TrustNotFound: + except exception.TrustNotFound: # nosec # if trust was deleted by concurrent process # consistency must not suffer pass @@ -244,11 +236,14 @@ class TrustDriverV8(object): @abc.abstractmethod def consume_use(self, trust_id): - """Consume one use when a trust was created with a limitation on its - uses, provided there are still uses available. + """Consume one use of a trust. + + One use of a trust is consumed when the trust was created with a + limitation on its uses, provided there are still uses available. - :raises: keystone.exception.TrustUseLimitReached, - keystone.exception.TrustNotFound + :raises keystone.exception.TrustUseLimitReached: If no remaining uses + for trust. + :raises keystone.exception.TrustNotFound: If the trust doesn't exist. """ raise exception.NotImplemented() # pragma: no cover -- cgit 1.2.3-korg