From 5215782cbaa27e7efd462e95a7c9a66d080f9187 Mon Sep 17 00:00:00 2001 From: Muayyad alsadi Date: Sat, 18 Apr 2020 22:15:55 +0300 Subject: [PATCH] Fixes #152: validate that podman is useable --- podman_compose.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/podman_compose.py b/podman_compose.py index 7a08f57..d135f62 100755 --- a/podman_compose.py +++ b/podman_compose.py @@ -797,11 +797,20 @@ class PodmanCompose: podman_path = os.path.realpath(podman_path) else: # this also works if podman hasn't been installed now - if dry_run == False: + if args.dry_run == False: raise IOError( "Binary {} has not been found.".format(podman_path)) - self.podman = Podman(self, podman_path, args.dry_run) + if not args.dry_run: + # just to make sure podman is running + try: + self.podman_version = self.podman.output(["--version"]).decode('utf-8').strip() + except subprocess.CalledProcessError: + self.podman_version = None + if not self.podman_version: + sys.stderr.write('it seems that you do not useable `podman`\n') + exit(-1) + print("using podman version: "+self.podman_version) cmd_name = args.command cmd = self.commands[cmd_name] cmd(self, args)