From 3c84d66de9a07c69c22e94fdf743a2a4687e02eb Mon Sep 17 00:00:00 2001 From: Angus Salkeld Date: Mon, 14 May 2012 21:14:55 +1000 Subject: [PATCH] Check for the presence of Metadat before trying to include it the multipart Signed-off-by: Angus Salkeld --- heat/engine/instance.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/heat/engine/instance.py b/heat/engine/instance.py index 2199744af..96eb54ea0 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,