Check whether pod exists before trying to create one

Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
This commit is contained in:
Povilas Kanapickas 2024-07-03 19:15:19 +03:00
parent 0ea4cbe091
commit 24038dace3
2 changed files with 9 additions and 0 deletions

View File

@ -0,0 +1 @@
Fixed a bug that caused attempts to create already existing pods multiple times.

View File

@ -2422,8 +2422,16 @@ async def compose_build(compose, args):
return status
async def pod_exists(compose, name):
exit_code = await compose.podman.run([], "pod", ["exists", name])
return exit_code == 0
async def create_pods(compose, args): # pylint: disable=unused-argument
for pod in compose.pods:
if await pod_exists(compose, pod["name"]):
continue
podman_args = [
"create",
"--name=" + pod["name"],