Fix LP #1819284 and barbican.get_secret of barbican service

Because secret class is lazy in barbican client, secret would
really access the api to get secret properties while calling
some property.

Closes-bug: #1819284

Change-Id: I0e37ccbb0bc74621f9dd47adbff98d64f2f79653
This commit is contained in:
chenhb 2019-04-19 10:39:37 +08:00 committed by Andrey Kurilin
parent a539f306c1
commit 2da73584fd
3 changed files with 17 additions and 2 deletions

View File

@ -26,6 +26,13 @@ Changed
Cinder service. To use another service type, use ``api_versions@openstack``
context or ``api_info`` property of environment configuration.
Fixed
~~~~~~~
* Close bug LP #1819284. Because secret class is lazy in barbican client,
secret would really access the api to get secret properties while calling
some property.
[1.4.0] - 2019-03-07
--------------------

View File

@ -1112,7 +1112,7 @@ class BarbicanSecrets(base.ResourceManager):
def is_deleted(self):
try:
self._manager().get(self.id())
self._manager().get(self.id()).status
except Exception:
return True

View File

@ -58,7 +58,15 @@ class BarbicanService(service.Service):
:param secret_name: The name of the secret.
"""
return self._clients.barbican().secrets.get(secret_ref)
secret = self._clients.barbican().secrets.get(secret_ref)
# secret is lazy, its properties would be filled with real
# values while getting some property.
try:
secret.status
except Exception as e:
from rally import exceptions
raise exceptions.GetResourceFailure(resource=secret, err=e)
return secret
@atomic.action_timer("barbican.delete_secret")
def delete_secret(self, secret_name):