The previous commit to the tree organizes resource names by
stack.resource. Most of the openstack APIs take resource ids
but the instance create operation requires text identifiers.
Rewrite the text identifiers for the nova security groups before
starting an instance.
Change-Id: I8a842868781ecb353f66b5a4e3d022766a4c8a0e
Signed-off-by: Steven Dake <sdake@redhat.com>
return self.mime_string
def handle_create(self):
- security_groups = self.properties.get('SecurityGroups')
+ if self.properties.get('SecurityGroups') == None:
+ security_groups = None
+ else:
+ security_groups = [self.physical_resource_name_find(sg) for sg in
+ self.properties.get('SecurityGroups')]
+
userdata = self.properties['UserData']
userdata += '\ntouch /var/lib/cloud/instance/provision-finished\n'
flavor = self.properties['InstanceType']
def physical_resource_name(self):
return '%s.%s' % (self.stack.name, self.name)
+ def physical_resource_name_find(self, resource_name):
+ if name in self.stack:
+ return '%s.%s' % (self.stack.name, name)
+ else:
+ raise IndexError('no such resource')
+
def validate(self):
logger.info('Validating %s' % str(self))