Skip to content

Commit 9cbe3ef

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 9cbe3ef

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

src/gardenlinux/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@
166166
GARDENLINUX_GITHUB_RELEASE_BUCKET_NAME = "gardenlinux-github-releases"
167167
GLVD_BASE_URL = "https://security.gardenlinux.org/v1"
168168

169-
PODMAN_CONNECTION_MAX_IDLE_SECONDS = 3
169+
PODMAN_CONNECTION_MAX_IDLE_SECONDS = 8
170170

171171
# https://github.com/gardenlinux/gardenlinux/issues/3044
172172
# Empty string is the 'legacy' variant with traditional root fs and still needed/supported

src/gardenlinux/oci/podman_context.py

Lines changed: 10 additions & 6 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,7 +59,7 @@ 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

@@ -137,15 +137,19 @@ def _wait_for_socket(self, sock: str) -> None:
137137
:since: 1.0.0
138138
"""
139139

140+
# Use variable for status to catch corner cases of fast closing sockets
141+
is_socket_available = False
140142
sock_path = Path(sock)
141143

142-
for _ in range(0, 5 * PODMAN_CONNECTION_MAX_IDLE_SECONDS):
143-
if sock_path.exists():
144+
for _ in range(0, PODMAN_CONNECTION_MAX_IDLE_SECONDS):
145+
is_socket_available = sock_path.exists()
146+
147+
if is_socket_available:
144148
break
145149

146-
sleep(0.2)
150+
sleep(1)
147151

148-
if not sock_path.exists():
152+
if not is_socket_available:
149153
raise TimeoutError()
150154

151155
@staticmethod

0 commit comments

Comments
 (0)