Skip to content

Commit

Permalink
Implement SecurityGroupIds property for instances
Browse files Browse the repository at this point in the history
Currently handling SecurityGroups and SecurityGroupIds the same exact
way, that is both are passed directly to nova. If one wishes to pass
a security group by parameter of a group to be created in the template,
it must be in the format of <stackname>.<security group name> since
there's no way to determine the ID beforehand.

Fixes bug #1163991

Change-Id: I26bb43ee89806cefc92ba2d0319340c4cd56ed06
  • Loading branch information
jpeeler committed May 24, 2013
1 parent 32c21dc commit 3eafb93
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions heat/engine/resources/instance.py
Expand Up @@ -89,8 +89,7 @@ class Instance(resource.Resource):
'RamDiskId': {'Type': 'String',
'Implemented': False},
'SecurityGroups': {'Type': 'List'},
'SecurityGroupIds': {'Type': 'List',
'Implemented': False},
'SecurityGroupIds': {'Type': 'List'},
'NetworkInterfaces': {'Type': 'List'},
'SourceDestCheck': {'Type': 'Boolean',
'Implemented': False},
Expand Down Expand Up @@ -272,7 +271,14 @@ def _build_nics(self, network_interfaces, subnet_id=None):
return nics

def handle_create(self):
security_groups = self.properties.get('SecurityGroups')
security_groups = []
for property in ('SecurityGroups', 'SecurityGroupIds'):
if self.properties.get(property) is not None:
for sg in self.properties.get(property):
security_groups.append(sg)
if not security_groups:
security_groups = None

userdata = self.properties['UserData'] or ''
flavor = self.properties['InstanceType']
key_name = self.properties['KeyName']
Expand Down

0 comments on commit 3eafb93

Please sign in to comment.