Not just output, move this whole thing out.

This commit is contained in:
Fabrice Flore-Thébault 2020-06-04 10:11:03 +02:00
parent 818a909222
commit 79528ec13e

View file

@ -82,14 +82,14 @@ def get_docker_user() -> Tuple[str, ...]: # pragma: win32 no cover
('docker', 'system', 'info'),
text=True,
)
for line in output.splitlines():
# rootless docker has "rootless"
# rootless podman has "rootless: true"
if line.strip().startswith('rootless'):
if 'false' not in line:
return () # no -u for rootless
break
try:
for line in output.splitlines():
# rootless docker has "rootless"
# rootless podman has "rootless: true"
if line.strip().startswith('rootless'):
if 'false' not in line:
return () # no -u for rootless
break
return ('-u', f'{os.getuid()}:{os.getgid()}')
except AttributeError:
return ()