Skip to content

Commit 5dcfa14

Browse files
authored
Merge pull request #1408 from marcsello/podman-probe-better-error
Better error message when podman probe fails
2 parents 9a82af2 + 3787e75 commit 5dcfa14

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Better error message when probing for podman fails.

podman_compose.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2181,10 +2181,17 @@ async def run(self, argv: list[str] | None = None) -> None:
21812181
"utf-8"
21822182
).strip() or ""
21832183
self.podman_version = (self.podman_version.split() or [""])[-1]
2184-
except (subprocess.CalledProcessError, FileNotFoundError):
2184+
except (subprocess.CalledProcessError, FileNotFoundError) as e:
2185+
msg = str(e)
2186+
if isinstance(e, subprocess.CalledProcessError) and e.output:
2187+
msg += f": {e.output.decode('utf-8')}"
2188+
log.error("failed to check if podman is installed: %s", msg)
21852189
self.podman_version = None
21862190
if not self.podman_version:
2187-
log.fatal("it seems that you do not have `podman` installed")
2191+
log.fatal(
2192+
"It seems that you either do not have `podman` installed "
2193+
"or the `podman version` command failed."
2194+
)
21882195
sys.exit(1)
21892196
log.info("using podman version: %s", self.podman_version)
21902197
cmd_name = args.command

0 commit comments

Comments
 (0)