Don’t crash on empty AMI name

This commit is contained in:
Guillaume Plessis 2017-08-23 12:58:23 -07:00
parent 19e15d15bf
commit cb886fe3d6

2
bootstrapvz/providers/ec2/tasks/ami.py Normal file → Executable file
View file

@ -23,7 +23,7 @@ class AMIName(Task):
images = info._ec2['connection'].describe_images(Owners=['self'])['Images']
for image in images:
if ami_name == image['Name']:
if 'Name' in image and ami_name == image['Name']:
msg = 'An image by the name {ami_name} already exists.'.format(ami_name=ami_name)
raise TaskError(msg)
info._ec2['ami_name'] = ami_name