From 841fdf1ffb362341144c6a566e9505b3d379ab95 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Fri, 10 Sep 2021 11:07:58 -0700 Subject: [PATCH] Move the 'unknown' image check below the renaming gubbins Signed-off-by: Adam Williamson --- createhdds.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/createhdds.py b/createhdds.py index e449693..a4d07fb 100755 --- a/createhdds.py +++ b/createhdds.py @@ -605,11 +605,6 @@ def check(hdds, nextrel=None): unknown = [] # Get the list of all 'expected' images expected = get_all_images(hdds, nextrel=nextrel) - # Get the list of all present image files - files = set(fl for fl in os.listdir('.') if fl.startswith('disk') and fl.endswith('img')) - # Compare present images vs. expected images to produce 'unknown' - expnames = set(img.filename for img in expected) - unknown = list(files.difference(expnames)) # Now determine if images are absent or outdated for img in expected: @@ -628,6 +623,12 @@ def check(hdds, nextrel=None): continue current.append(img) + # Get the list of all present image files + files = set(fl for fl in os.listdir('.') if fl.startswith('disk') and (fl.endswith('img') or fl.endswith('qcow2'))) + # Compare present images vs. expected images to produce 'unknown' + expnames = set(img.filename for img in expected) + unknown = list(files.difference(expnames)) + logger.debug("Current images: %s", ', '.join([img.filename for img in current])) logger.debug("Missing images: %s", ', '.join([img.filename for img in missing])) logger.debug("Outdated images: %s", ', '.join([img.filename for img in outdated]))