Apply ResourceGroup blacklist at create time

Because of the requirement that the nested stack exist, the blacklist was
previously ignored at the time the ResourceGroup was created and only
applied on subsequent updates.

Change-Id: I43dbb13e12fad349a226cffe5d0e96ed7fce3aeb
Closes-Bug: #1585206
This commit is contained in:
Zane Bitter 2016-05-24 09:29:48 -04:00
parent b7cbfef696
commit 5f1d3bb6d6
1 changed files with 11 additions and 12 deletions

View File

@ -308,18 +308,17 @@ class ResourceGroup(stack_resource.StackResource):
# with any additional names
rsrc_names = set(current_blacklist)
if nested:
for r in self.properties[self.REMOVAL_POLICIES]:
if self.REMOVAL_RSRC_LIST in r:
# Tolerate string or int list values
for n in r[self.REMOVAL_RSRC_LIST]:
str_n = six.text_type(n)
if str_n in nested:
rsrc_names.add(str_n)
continue
rsrc = nested.resource_by_refid(str_n)
if rsrc:
rsrc_names.add(rsrc.name)
for r in self.properties[self.REMOVAL_POLICIES]:
if self.REMOVAL_RSRC_LIST in r:
# Tolerate string or int list values
for n in r[self.REMOVAL_RSRC_LIST]:
str_n = six.text_type(n)
if not nested or str_n in nested:
rsrc_names.add(str_n)
continue
rsrc = nested.resource_by_refid(str_n)
if rsrc:
rsrc_names.add(rsrc.name)
# If the blacklist has changed, update the resource data
if rsrc_names != set(current_blacklist):