[Core-Library] Reset all out properties during releasing

Closes-Bug: #1514779
Change-Id: Ibeae1cda1b62de0d330832cf89f670d5224180c9
This commit is contained in:
Dmytro Dovbii 2016-02-08 10:21:49 +02:00
parent c5725038d3
commit c6b9e580a6
4 changed files with 40 additions and 8 deletions

View File

@ -26,13 +26,14 @@ Properties:
Contract: $.string()
Usage: Out
Workflow:
Methods:
initialize:
Body:
- $.environment: $.find(Environment).require()
- $.network: $.environment.defaultNetworks.environment
- $.instances: []
deploy:
Body:
- If: not $.getAttr(deployed, false)
@ -59,20 +60,20 @@ Workflow:
- If: $.assignFloatingIp
Then:
- $extNetId: $networkData.floatingIpNetId
- $fip_name: format('Shared-Floating-ip-{0}', $.id())
- $fipName: format('Shared-Floating-ip-{0}', $.id())
- $template:
resources:
$fip_name:
$fipName:
type: 'OS::Neutron::FloatingIP'
properties:
floating_network_id: $extNetId
port_id:
get_resource: $aapPortName
outputs:
$fip_name + '-val':
$fipName + '-val':
value:
get_attr: [$fip_name, floating_ip_address]
get_attr: [$fipName, floating_ip_address]
description: Shared Floating IP assigned
- $.environment.stack.updateTemplate($template)
@ -95,6 +96,16 @@ Workflow:
get_attr: [$aapPortName, fixed_ips, 0, ip_address]
releaseResources:
Body:
- $template: $.environment.stack.current()
- $template.resources: $template.resources.delete(format('AllowedAddressPairsPort-{0}', id($)))
- $template.outputs: $template.outputs.delete(format('AllowedAddressPairsPort-{0}-virtualIp', id($)))
- If: $.assignFloatingIp
Then:
- $template.resources: $template.resources.delete(format('Shared-Floating-ip-{0}', id($)))
- $template.outputs: $template.outputs.delete(format('Shared-Floating-ip-{0}-val', id($)))
- $._environment.stack.setTemplate($template)
- $._environment.stack.push()
- $.floatingIpAddress: null
- $.virtualIp: null

View File

@ -129,6 +129,7 @@ Methods:
- $._environment.stack.setTemplate($template)
- $._environment.stack.push()
- $.setAttr(lastTemplate, null)
- $.openstackId: null
getRef:
Body:

View File

@ -270,6 +270,9 @@ Methods:
- $.setAttr(instanceResources, [])
- $.setAttr(instanceOutputs, [])
- $.setAttr(fipAssigned, false)
- $.openstackId: null
- $.ipAddresses: []
- $.floatingIpAddress: null
destroy:
Body:

View File

@ -184,6 +184,23 @@ Methods:
gateway: $subnet.gateway_ip
floatingIpNetId: $._getExternalNetId()
releaseResources:
Body:
- $template: $.environment.stack.current()
- $template.resources: $template.resources.delete(format('{0}-{1}', $.name, $.id()))
- $template.resources: $template.resources.delete($._getSubnetName())
- $template.outputs: $template.outputs.delete(format('{0}-id', $.name))
- If: $.externalRouterId != null
Then:
$template.resources: $template.resources.delete($._getRouterInterfaceName())
- $._environment.stack.setTemplate($template)
- $._environment.stack.push()
- $.openstackId: null
_getRouterInterfaceName:
Body: