diff options
author | Ethan Lynn <xuanlangjian@gmail.com> | 2018-12-25 11:15:13 +0800 |
---|---|---|
committer | Rabi Mishra <ramishra@redhat.com> | 2019-03-22 06:39:02 +0000 |
commit | 3a51498e6819fb58934516d2e78adb5a7098461a (patch) | |
tree | c315361fcb418c1d4e4e994cea117ebe8babf690 | |
parent | 7de81ac819037470e5df56d8619887bc49e24311 (diff) | |
download | heat-3a51498e6819fb58934516d2e78adb5a7098461a.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.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/heat/engine/stack.py b/heat/engine/stack.py index e0bfe0bec..2bb7cb238 100644 --- a/heat/engine/stack.py +++ b/heat/engine/stack.py @@ -822,11 +822,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) |