Skip to content

Commit 86de1ab

Browse files
committed
fix pylint warnings
1 parent 9c60495 commit 86de1ab

File tree

1 file changed

+21
-10
lines changed

1 file changed

+21
-10
lines changed

podman_compose.py

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3148,12 +3148,12 @@ class PullImage:
31483148

31493149
def __post_init__(self) -> None:
31503150
if self.policy not in self.POLICY_PRIORITY:
3151-
log.debug(f"Pull policy {self.policy} is not valid, using 'missing' instead")
3151+
log.debug("Pull policy %s is not valid, using 'missing' instead", self.policy)
31523152
self.policy = "missing"
31533153

31543154
def update_policy(self, new_policy: str) -> None:
31553155
if new_policy not in self.POLICY_PRIORITY:
3156-
log.debug(f"Pull policy {new_policy} is not valid, ignoring it")
3156+
log.debug("Pull policy %s is not valid, ignoring it", new_policy)
31573157
return
31583158

31593159
if self.POLICY_PRIORITY[new_policy] > self.POLICY_PRIORITY[self.policy]:
@@ -3215,17 +3215,16 @@ async def pull_images(
32153215
return 0
32163216

32173217

3218-
@cmd_run(podman_compose, "up", "Create and start the entire stack or some of its services")
3219-
async def compose_up(compose: PodmanCompose, args: argparse.Namespace) -> int | None:
3220-
excluded = get_excluded(compose, args)
3221-
3218+
async def prepare_images(
3219+
compose: PodmanCompose, args: argparse.Namespace, excluded: set[str]
3220+
) -> int | None:
32223221
log.info("pulling images: ...")
3222+
32233223
pull_services = [v for k, v in compose.services.items() if k not in excluded]
32243224
err = await PullImage.pull_images(compose.podman, args, pull_services)
32253225
if err:
32263226
log.error("Pull image failed")
3227-
if not args.dry_run:
3228-
return err
3227+
return err
32293228

32303229
log.info("building images: ...")
32313230

@@ -3235,8 +3234,20 @@ async def compose_up(compose: PodmanCompose, args: argparse.Namespace) -> int |
32353234
build_exit_code = await compose.commands["build"](compose, build_args)
32363235
if build_exit_code != 0:
32373236
log.error("Build command failed")
3238-
if not args.dry_run:
3239-
return build_exit_code
3237+
return build_exit_code
3238+
3239+
return 0
3240+
3241+
3242+
@cmd_run(podman_compose, "up", "Create and start the entire stack or some of its services")
3243+
async def compose_up(compose: PodmanCompose, args: argparse.Namespace) -> int | None:
3244+
excluded = get_excluded(compose, args)
3245+
3246+
exit_code = await prepare_images(compose, args, excluded)
3247+
if exit_code != 0:
3248+
log.error("Prepare images failed")
3249+
if not args.dry_run:
3250+
return exit_code
32403251

32413252
# if needed, tear down existing containers
32423253

0 commit comments

Comments
 (0)