Forces applications to be deleted before Heat stack

After multi-region support was merged there are CloudRegion
objects that hold Heat stacks and applications that are not
owned by the regions. When Environment get deleted there is
no guarantee that applications will be deleted before regions.
If regions were deleted first Heat stacks will be deleted and
any attempt for an application to send any script to its
instance will cause it to hang waiting for the terminated
instance to answer

This commit adds destruction dependency between
application and region first time application
accesses it. Thus region is going to be deleted
after application if both are deleted at the same time
(e.g. upon Environment delete).

Also prevent default region re-creation and loosing
its destruction dependencies. In earlier versions
default region had a null name rather than an empty
string. Then it was changed everywhere except for
this one place.

Change-Id: I88b37345b3a77146241cebe1b9e0a32b44e4be11
Closes-Bug: #1623612
This commit is contained in:
Stan Lagun 2016-09-14 11:26:32 -07:00
parent 4eef41ce3f
commit 0e55368e2a
2 changed files with 5 additions and 1 deletions

View File

@ -1,5 +1,6 @@
Namespaces:
=: io.murano
sys: io.murano.system
Name: CloudResource
@ -26,4 +27,7 @@ Methods:
- If: $._region = null or $._region.name != $regionName
Then:
$._region: $env.regions[$regionName]
- If: $._region != null
Then:
- sys:GC.subscribeDestruction($this, $._region)
- Return: $._region

View File

@ -87,7 +87,7 @@ Methods:
where($ and not $this.regions.containsKey($)).
select($this._createRegion($)).
toDict($.name)
- If: not $.regions.containsKey(null)
- If: not $.regions.containsKey('')
Then:
- If: $.homeRegionName
Then: