From 036dab933af06f59df3f9f5b709a83de63dfbfcf Mon Sep 17 00:00:00 2001 From: Lewis Gaul Date: Mon, 23 Jan 2023 18:14:39 +0000 Subject: [PATCH 1/2] Ignore stderr from 'podman build --quiet' when getting the image ID --- python_on_whales/components/image/cli_wrapper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python_on_whales/components/image/cli_wrapper.py b/python_on_whales/components/image/cli_wrapper.py index cb73338f..36b859a1 100644 --- a/python_on_whales/components/image/cli_wrapper.py +++ b/python_on_whales/components/image/cli_wrapper.py @@ -279,7 +279,7 @@ def legacy_build( self.client_config ) full_cmd.append(context_path) - image_id = run(full_cmd).strip() + image_id = run(full_cmd, return_stderr=True)[0].strip() return docker_image.inspect(image_id) def history(self): From cb7cff83506828b55b00018eb8dc0e92dfd3cbd4 Mon Sep 17 00:00:00 2001 From: Lewis Gaul Date: Mon, 23 Jan 2023 18:38:41 +0000 Subject: [PATCH 2/2] Just take last line from build output as image ID, since podman-remote causes stderr to end up on stdout --- python_on_whales/components/image/cli_wrapper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python_on_whales/components/image/cli_wrapper.py b/python_on_whales/components/image/cli_wrapper.py index 36b859a1..feb26ba1 100644 --- a/python_on_whales/components/image/cli_wrapper.py +++ b/python_on_whales/components/image/cli_wrapper.py @@ -279,7 +279,7 @@ def legacy_build( self.client_config ) full_cmd.append(context_path) - image_id = run(full_cmd, return_stderr=True)[0].strip() + image_id = run(full_cmd).splitlines()[-1].strip() return docker_image.inspect(image_id) def history(self):