@@ -2058,17 +2058,17 @@ def resolve_pod_name(self) -> str | None:
2058
2058
# - docker-compose.yml x-podman.in_pod
2059
2059
# - Default value of true
2060
2060
in_pod_arg = self .global_args .in_pod or self .x_podman .get (
2061
- PodmanCompose .XPodmanSettingKey .IN_POD , True )
2061
+ PodmanCompose .XPodmanSettingKey .IN_POD , True
2062
+ )
2062
2063
2063
2064
in_pod_arg_parsed = try_parse_bool (in_pod_arg )
2064
2065
if in_pod_arg_parsed is True :
2065
2066
return f"pod_{ self .project_name } "
2066
- elif in_pod_arg_parsed is False :
2067
+ if in_pod_arg_parsed is False :
2067
2068
return None
2068
- else :
2069
- # Arg is a non-emty string that does not parse to a boolean,
2070
- # so we treat it as a pod name.
2071
- return in_pod_arg
2069
+ # Arg is a non-emty string that does not parse to a boolean,
2070
+ # so we treat it as a pod name.
2071
+ return in_pod_arg
2072
2072
2073
2073
def resolve_pod_args (self ) -> list [str ]:
2074
2074
# Priorities:
@@ -2087,10 +2087,10 @@ def join_name_parts(self, *parts: str) -> str:
2087
2087
sep = "-"
2088
2088
else :
2089
2089
sep = "_"
2090
-
2091
2090
return sep .join (parts )
2092
2091
2093
2092
def format_name (self , * parts : str ) -> str :
2093
+ assert self .project_name is not None
2094
2094
return self .join_name_parts (self .project_name , * parts )
2095
2095
2096
2096
def _parse_x_podman_settings (self , compose : dict [str , Any ], environ : dict [str , str ]) -> None :
@@ -2942,15 +2942,15 @@ async def pod_exists(compose: PodmanCompose, name: str) -> bool:
2942
2942
return exit_code == 0
2943
2943
2944
2944
2945
- async def create_pods (compose : PodmanCompose , args : argparse . Namespace ) -> None :
2945
+ async def create_pods (compose : PodmanCompose ) -> None :
2946
2946
for pod in compose .pods :
2947
2947
if await pod_exists (compose , pod ["name" ]):
2948
2948
continue
2949
2949
2950
2950
podman_args = [
2951
2951
"create" ,
2952
2952
"--name=" + pod ["name" ],
2953
- ]+ compose .resolve_pod_args ()
2953
+ ] + compose .resolve_pod_args ()
2954
2954
2955
2955
ports = pod .get ("ports" , [])
2956
2956
if isinstance (ports , str ):
@@ -3084,7 +3084,7 @@ async def compose_up(compose: PodmanCompose, args: argparse.Namespace) -> int |
3084
3084
log .info ("recreating: done\n \n " )
3085
3085
# args.no_recreate disables check for changes (which is not implemented)
3086
3086
3087
- await create_pods (compose , args )
3087
+ await create_pods (compose )
3088
3088
exit_code = 0
3089
3089
for cnt in compose .containers :
3090
3090
if cnt ["_service" ] in excluded :
@@ -3328,7 +3328,7 @@ async def compose_ps(compose: PodmanCompose, args: argparse.Namespace) -> None:
3328
3328
"create a container similar to a service to run a one-off command" ,
3329
3329
)
3330
3330
async def compose_run (compose : PodmanCompose , args : argparse .Namespace ) -> None :
3331
- await create_pods (compose , args )
3331
+ await create_pods (compose )
3332
3332
compose .assert_services (args .service )
3333
3333
container_names = compose .container_names_by_service [args .service ]
3334
3334
container_name = container_names [0 ]
@@ -3373,7 +3373,7 @@ def compose_run_update_container_from_args(
3373
3373
compose : PodmanCompose , cnt : dict , args : argparse .Namespace
3374
3374
) -> None :
3375
3375
# adjust one-off container options
3376
- name0 = compose .format_name (args .service , str ( random .randrange (0 , 65536 )) )
3376
+ name0 = compose .format_name (args .service , f'tmp { random .randrange (0 , 65536 )} ' )
3377
3377
cnt ["name" ] = args .name or name0
3378
3378
if args .entrypoint :
3379
3379
cnt ["entrypoint" ] = args .entrypoint
0 commit comments