summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEthan Lynn <xuanlangjian@gmail.com>2018-12-25 11:15:13 +0800
committerRabi Mishra <ramishra@redhat.com>2019-03-22 13:44:42 +0000
commit3fa1cbd9f81d7c2300a7f50a6f0660aafc370dd9 (patch)
tree2fcf0c7594d49df95d0572bc9085eb1ff0f4c56e
parentbe382ccdd505e1472ed45b96bd9e2eadbe5e3682 (diff)
downloadheat-3fa1cbd9f81d7c2300a7f50a6f0660aafc370dd9.tar.gz
Fix SoftwareDeployment on DELETE action
When we specify a sd on delete action, os-collect-config will not get authentication because we didn't load access_allowed_handlers after stack enter stack delete phrase. This patch will make sure we load necessary access_allowed_handlers even if in stack delete phrase. Change-Id: I43c1a865f507f7cb7757e26ae5c503ce484ee280 Story: #2004661 Task: #28628 (cherry picked from commit 0e1ed1a4b23142ff379e01a3574fef771f703915)
-rw-r--r--heat/engine/stack.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/heat/engine/stack.py b/heat/engine/stack.py
index 15e995566..406794df0 100644
--- a/heat/engine/stack.py
+++ b/heat/engine/stack.py
@@ -823,11 +823,11 @@ class Stack(collections.Mapping):
def access_allowed(self, credential_id, resource_name):
"""Is credential_id authorised to access resource by resource_name."""
- if not self.resources:
- # this also triggers lazy-loading of resources
- # so is required for register_access_allowed_handler
- # to be called
- return False
+ if not self.resources or resource_name not in self.resources:
+ # this handle the case that sd in action delete,
+ # try to load access_allowed_handlers if resources object
+ # haven't been loaded.
+ [res.name for res in self.iter_resources()]
handler = self._access_allowed_handlers.get(credential_id)
return handler and handler(resource_name)