Skip to content

Commit 36ab3b2

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 36ab3b2

2 files changed

Lines changed: 15 additions & 8 deletions

File tree

src/gardenlinux/oci/podman.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,10 +278,13 @@ def tag(
278278
:since: 1.0.0
279279
"""
280280

281-
oci_data = oci_container_tag.rsplit(":", 1)
281+
if ":" in oci_container_tag:
282+
oci_data = oci_container_tag.rsplit(":", 1)
282283

283-
if len(oci_data) < 2:
284-
raise RuntimeError("No tag given")
284+
if len(oci_data) < 2:
285+
raise RuntimeError("No tag given")
286+
else:
287+
oci_data = ( "", oci_container_tag )
285288

286289
image = podman.images.get(image_id)
287290
image.tag(oci_data[0], oci_data[1])

src/gardenlinux/oci/podman_context.py

Lines changed: 9 additions & 5 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, 50 * PODMAN_CONNECTION_MAX_IDLE_SECONDS):
145+
is_socket_available = sock_path.exists()
146+
147+
if is_socket_available:
144148
break
145149

146150
sleep(0.2)
147151

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

151155
@staticmethod

0 commit comments

Comments
 (0)