From: Angus Salkeld Date: Mon, 14 May 2012 11:14:55 +0000 (+1000) Subject: Check for the presence of Metadat before trying to include it the multipart X-Git-Tag: 2014.1~1832 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=3c84d66de9a07c69c22e94fdf743a2a4687e02eb;p=openstack-build%2Fheat-build.git Check for the presence of Metadat before trying to include it the multipart Signed-off-by: Angus Salkeld --- diff --git a/heat/engine/instance.py b/heat/engine/instance.py index 2199744a..96eb54ea 100644 --- a/heat/engine/instance.py +++ b/heat/engine/instance.py @@ -102,11 +102,12 @@ class Instance(Resource): filename='part-handler.py') mime_blob.attach(msg) - msg = MIMEText(json.dumps(self.t['Metadata']), - _subtype='x-cfninitdata') - msg.add_header('Content-Disposition', 'attachment', - filename='cfn-init-data') - mime_blob.attach(msg) + if 'Metadata' in self.t: + msg = MIMEText(json.dumps(self.t['Metadata']), + _subtype='x-cfninitdata') + msg.add_header('Content-Disposition', 'attachment', + filename='cfn-init-data') + mime_blob.attach(msg) if self.stack.metadata_server: msg = MIMEText(self.stack.metadata_server,