From 2ecf7f41fc883ad1c7337470bb29c2b589d7b031 Mon Sep 17 00:00:00 2001 From: Patryk Matuszak Date: Fri, 26 Apr 2024 09:01:57 +0200 Subject: [PATCH 1/2] Fix restart_job so it's aware of warnings printed to stdout --- test/bin/wait_images.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/bin/wait_images.py b/test/bin/wait_images.py index d289e0bd0d..419b9ea991 100755 --- a/test/bin/wait_images.py +++ b/test/bin/wait_images.py @@ -86,7 +86,14 @@ def restart_job(cmd): result = subprocess.run(cmd, shell=True, text=True, stdout=subprocess.PIPE) if result.returncode != 0: return "" - return result.stdout.split(" ")[1] + # Osbuild emits a warning on stdout about functionality we don't use in our blueprints, + # so we need to skip the lines we don't find interesting. Example output: + # > Warning: Please note that user customizations on "edge-commit" image type are deprecated and will be removed in the near future + # > + # > Compose 2c6a1ba2-4a18-49b8-a0f1-d103de1bd93a added to the queue + # Split output with \n and select line starting with "Compose", then split that line with space and select 2nd word. + line_with_id = [line for line in result.stdout.split("\n") if line.startswith("Compose")][0] + return line_with_id.split(" ")[1] def copy_build_metadata(old_id, new_id): From 846456435c3ed1f7d1a095491cff42a94c0d54d2 Mon Sep 17 00:00:00 2001 From: Patryk Matuszak Date: Fri, 26 Apr 2024 14:35:35 +0200 Subject: [PATCH 2/2] Use generator instead of list comprehension Co-authored-by: Pablo Acevedo Montserrat --- test/bin/wait_images.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/bin/wait_images.py b/test/bin/wait_images.py index 419b9ea991..b86f92d8cf 100755 --- a/test/bin/wait_images.py +++ b/test/bin/wait_images.py @@ -92,7 +92,7 @@ def restart_job(cmd): # > # > Compose 2c6a1ba2-4a18-49b8-a0f1-d103de1bd93a added to the queue # Split output with \n and select line starting with "Compose", then split that line with space and select 2nd word. - line_with_id = [line for line in result.stdout.split("\n") if line.startswith("Compose")][0] + line_with_id = next(line for line in result.stdout.split("\n") if line.startswith("Compose")) return line_with_id.split(" ")[1]