From 5b731d009bb64da7701c08a7f3d5138449007446 Mon Sep 17 00:00:00 2001 From: Dmitriy Smirnov Date: Tue, 28 May 2024 16:26:42 +0300 Subject: [PATCH] Add validated_image_id check to if-condition of deleting image logic --- library/decort_osimage.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/decort_osimage.py b/library/decort_osimage.py index b78c89e..8aef066 100644 --- a/library/decort_osimage.py +++ b/library/decort_osimage.py @@ -522,7 +522,7 @@ def main(): decon.validated_image_id = decort_osimage.decort_osimage_package_facts(image_facts)['id'] - elif amodule.params['state'] == "absent": + elif amodule.params['state'] == "absent" and decon.validated_image_id: if amodule.params['image_name'] or amodule.params['image_id'] and\ decort_osimage.decort_osimage_package_facts(image_facts)['accountId'] == amodule.params['account_Id']: amodule.image_id_delete = decon.validated_image_id