Merge "Fix SoftwareDeployment on DELETE action"

This commit is contained in:
Zuul 2019-03-20 19:02:01 +00:00 committed by Gerrit Code Review
commit 7b156dd846
1 changed files with 5 additions and 5 deletions

View File

@ -823,11 +823,11 @@ class Stack(collections.Mapping):
def access_allowed(self, credential_id, resource_name): def access_allowed(self, credential_id, resource_name):
"""Is credential_id authorised to access resource by resource_name.""" """Is credential_id authorised to access resource by resource_name."""
if not self.resources: if not self.resources or resource_name not in self.resources:
# this also triggers lazy-loading of resources # this handle the case that sd in action delete,
# so is required for register_access_allowed_handler # try to load access_allowed_handlers if resources object
# to be called # haven't been loaded.
return False [res.name for res in self.iter_resources()]
handler = self._access_allowed_handlers.get(credential_id) handler = self._access_allowed_handlers.get(credential_id)
return handler and handler(resource_name) return handler and handler(resource_name)