Fix EIP template.

Some of the implemented flags were wrong.
Allow the eip to be deleted when no eip was created.

Change-Id: Id1d3aaff9adf0988a5c58f8bf0f7b2fb9c7bde44
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
This commit is contained in:
Angus Salkeld 2012-06-22 12:01:55 +10:00
parent e30ee55ff9
commit 2eadedf5fd
3 changed files with 11 additions and 7 deletions

View File

@ -17,6 +17,7 @@ import logging
from heat.common import exception
from heat.engine.resources import Resource
from novaclient.exceptions import NotFound
logger = logging.getLogger('heat.engine.eip')
@ -104,5 +105,9 @@ class ElasticIpAssociation(Resource):
def handle_delete(self):
"""Remove a floating IP address from a server."""
server = self.nova().servers.get(self.properties['InstanceId'])
server.remove_floating_ip(self.properties['EIP'])
try:
server = self.nova().servers.get(self.properties['InstanceId'])
if server:
server.remove_floating_ip(self.properties['EIP'])
except NotFound as ex:
pass

View File

@ -91,8 +91,7 @@ class Instance(Resource):
'Implemented': False},
'RamDiskId': {'Type': 'String',
'Implemented': False},
'SecurityGroups': {'Type': 'List',
'Implemented': False},
'SecurityGroups': {'Type': 'List'},
'SecurityGroupIds': {'Type': 'List',
'Implemented': False},
'SourceDestCheck': {'Type': 'Boolean',

View File

@ -27,9 +27,9 @@ class SecurityGroup(Resource):
'Required': True},
'VpcId': {'Type': 'String',
'Implemented': False},
'SecurityGroupIngress': {'Type': 'List',
'Implemented': False},
'SecurityGroupEgress': {'Type': 'List'}}
'SecurityGroupIngress': {'Type': 'List'},
'SecurityGroupEgress': {'Type': 'List',
'Implemented': False}}
def __init__(self, name, json_snippet, stack):
super(SecurityGroup, self).__init__(name, json_snippet, stack)