Skip to content

Commit 987da13

Browse files
committed
Fix the default Podman integration socket base directory
Fixes: #336 Signed-off-by: Tobias Wolf <wolf@b1-systems.de> On-behalf-of: SAP <tobias.wolf@sap.com>
1 parent 80bcd46 commit 987da13

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

src/gardenlinux/oci/podman_context.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import logging
88
from contextlib import ExitStack
99
from functools import wraps
10-
from os import rmdir
10+
from os import environ, rmdir
1111
from pathlib import Path
1212
from subprocess import PIPE, STDOUT, Popen
1313
from tempfile import mkdtemp
@@ -59,14 +59,16 @@ def __enter__(self) -> Any:
5959
:since: 1.0.0
6060
"""
6161

62-
self._tmpdir = mkdtemp()
62+
self._tmpdir = mkdtemp(dir=environ.get("HOME"))
6363

6464
podman_sock = str(Path(self._tmpdir, "podman.sock").absolute())
6565

6666
self._podman = PodmanClient(base_url=f"unix://{podman_sock}")
6767
self._podman_daemon = Popen(
6868
args=[
6969
"podman",
70+
"--out=/tmp/podman.log",
71+
"--log-level=debug",
7072
"system",
7173
"service",
7274
f"--time={PODMAN_CONNECTION_MAX_IDLE_SECONDS}",
@@ -137,15 +139,19 @@ def _wait_for_socket(self, sock: str) -> None:
137139
:since: 1.0.0
138140
"""
139141

142+
# Use variable for status to catch corner cases of fast closing sockets
143+
is_socket_available = False
140144
sock_path = Path(sock)
141145

142146
for _ in range(0, 5 * PODMAN_CONNECTION_MAX_IDLE_SECONDS):
143-
if sock_path.exists():
147+
is_socket_available = sock_path.exists()
148+
149+
if is_socket_available:
144150
break
145151

146152
sleep(0.2)
147153

148-
if not sock_path.exists():
154+
if not is_socket_available:
149155
raise TimeoutError()
150156

151157
@staticmethod

0 commit comments

Comments
 (0)