Verify image exists when passed for server creation

If the image doesn't exist, we should fail and raise the error clearly. Fixes #18921
pull/19653/head
Mike Perez 8 years ago
parent 1da6a67c50
commit 6d32dba3c3

@ -447,6 +447,9 @@ def _create_server(module, cloud):
if not module.params['boot_volume']: if not module.params['boot_volume']:
image_id = cloud.get_image_id( image_id = cloud.get_image_id(
module.params['image'], module.params['image_exclude']) module.params['image'], module.params['image_exclude'])
if not image_id:
module.fail_json(msg="Could not find image %s" %
module.params['image'])
if flavor: if flavor:
flavor_dict = cloud.get_flavor(flavor) flavor_dict = cloud.get_flavor(flavor)

Loading…
Cancel
Save