From 82792ab5d50cf4bdfb450203045a9ba30c8d3f3c Mon Sep 17 00:00:00 2001 From: Christian Rohmann Date: Wed, 26 May 2021 18:21:08 +0200 Subject: [PATCH] Fail if referenced source image for a new volume does not exist Story: 2008926 Task: 42525 Change-Id: I867d6869744528aae3034a7e0add2d0e922a97ff --- plugins/modules/volume.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/modules/volume.py b/plugins/modules/volume.py index 8e953c74..3a50c05a 100644 --- a/plugins/modules/volume.py +++ b/plugins/modules/volume.py @@ -188,6 +188,8 @@ class VolumeModule(OpenStackModule): ) if self.params['image']: image_id = self.conn.get_image_id(self.params['image']) + if not image_id: + self.fail_json(msg="Failed to find image '%s'" % self.params['image']) volume_args['imageRef'] = image_id if self.params['volume']: