Fixes #152: validate that podman is useable

This commit is contained in:
Muayyad alsadi 2020-04-18 22:15:55 +03:00
parent 80e7ba188d
commit 5215782cba

View File

@ -797,11 +797,20 @@ class PodmanCompose:
podman_path = os.path.realpath(podman_path) podman_path = os.path.realpath(podman_path)
else: else:
# this also works if podman hasn't been installed now # this also works if podman hasn't been installed now
if dry_run == False: if args.dry_run == False:
raise IOError( raise IOError(
"Binary {} has not been found.".format(podman_path)) "Binary {} has not been found.".format(podman_path))
self.podman = Podman(self, podman_path, args.dry_run) 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_name = args.command
cmd = self.commands[cmd_name] cmd = self.commands[cmd_name]
cmd(self, args) cmd(self, args)