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 06:39:28 +0000
commit4601907daa70157c5942d5cc4ee1ae9eb3cc8356 (patch)
tree3f1d5ca3986407380440c548a7b04486bc157cf4
parentf0c08024f9c701126191e6afc1cbd9c69548bd21 (diff)
downloadheat-4601907daa70157c5942d5cc4ee1ae9eb3cc8356.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 ec948ffe7..01eb5defb 100644
--- a/heat/engine/stack.py
+++ b/heat/engine/stack.py
@@ -816,11 +816,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)