Handle empty UserData for instance

UserData is not required, so handle the case where it is not supplied (i.e.
is None).

bug 1090544

Change-Id: If8bfe9ba2aafe3bb2e9de14b01c57d1ddcf9b21d
Signed-off-by: Zane Bitter <zbitter@redhat.com>
This commit is contained in:
Zane Bitter 2012-12-14 22:45:07 +01:00
parent d9105f57e1
commit a64fc0bc4b

View File

@ -214,7 +214,7 @@ class Instance(resource.Resource):
security_groups = [self.physical_resource_name_find(sg) for sg in security_groups = [self.physical_resource_name_find(sg) for sg in
self.properties.get('SecurityGroups')] self.properties.get('SecurityGroups')]
userdata = self.properties['UserData'] userdata = self.properties['UserData'] or ''
userdata += '\ntouch /var/lib/cloud/instance/provision-finished\n' userdata += '\ntouch /var/lib/cloud/instance/provision-finished\n'
flavor = self.properties['InstanceType'] flavor = self.properties['InstanceType']
key_name = self.properties['KeyName'] key_name = self.properties['KeyName']