Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix autonomy deploy build command #2305

Open
wants to merge 3 commits into
base: fix/infinite-loop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions autonomy/cli/helpers/deployment.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2022-2024 Valory AG
# Copyright 2022-2025 Valory AG
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -66,10 +66,10 @@
from autonomy.deploy.image import build_image


def _build_dirs(build_dir: Path, mkdir: List[str]) -> None:
"""Build necessary directories."""
def _build_dirs(build_dir: Path, mkdir: Optional[List[str]] = None) -> None:
"""Build the necessary directories."""

mkdirs = [(new_dir_name,) for new_dir_name in mkdir]
mkdirs = [(new_dir_name,) for new_dir_name in mkdir] if mkdir else []

for dir_path in [
(PERSISTENT_DATA_DIR,),
Expand Down Expand Up @@ -282,6 +282,7 @@ def build_deployment( # pylint: disable=too-many-arguments, too-many-locals
build_dir.mkdir()
if service_hash_id is None:
service_hash_id = build_hash_id()
_build_dirs(build_dir, mkdir)

report = generate_deployment(
service_hash_id=service_hash_id,
Expand All @@ -306,8 +307,6 @@ def build_deployment( # pylint: disable=too-many-arguments, too-many-locals
image_author=image_author,
resources=resources,
)
if mkdir is not None:
_build_dirs(build_dir, mkdir)

click.echo(report)

Expand Down
2 changes: 1 addition & 1 deletion autonomy/deploy/generators/docker_compose/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ def _populate_keys(self) -> None:
)
key = cast(List[Dict[str, str]], self.service_builder.keys)[x][PRIVATE_KEY]
keys_file = path / PRIVATE_KEY_PATH_SCHEMA.format(ledger)
path.mkdir(parents=True)
path.mkdir()
with keys_file.open(mode="w", encoding=DEFAULT_ENCODING) as f:
f.write(key)

Expand Down
Loading