File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 ])
Original file line number Diff line number Diff line change 77import logging
88from contextlib import ExitStack
99from functools import wraps
10- from os import rmdir
10+ from os import environ , rmdir
1111from pathlib import Path
1212from subprocess import PIPE , STDOUT , Popen
1313from 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
You can’t perform that action at this time.
0 commit comments