Skip to content
Merged
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
14 changes: 7 additions & 7 deletions node_cli/operations/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def update(env_filepath: str, env: Dict, node_type: NodeType) -> bool:
distro.id(),
distro.version(),
)
update_images(env=env)
update_images(env=env, node_type=node_type)
compose_up(env=env, node_type=node_type)
return True

Expand Down Expand Up @@ -184,7 +184,7 @@ def migrate_mirage_boot(env_filepath: str, env: Dict) -> bool:
distro.id(),
distro.version(),
)
update_images(env=env)
update_images(env=env, node_type=NodeType.MIRAGE)
compose_up(env=env, node_type=NodeType.MIRAGE)
return True

Expand Down Expand Up @@ -226,7 +226,7 @@ def update_mirage_boot(env_filepath: str, env: Dict) -> bool:
distro.id(),
distro.version(),
)
update_images(env=env)
update_images(env=env, node_type=NodeType.MIRAGE)
compose_up(env=env, node_type=NodeType.MIRAGE, is_mirage_boot=True)
return True

Expand Down Expand Up @@ -260,7 +260,7 @@ def init(env_filepath: str, env: dict, node_type: NodeType) -> None:
distro.version(),
)
update_resource_allocation(env_type=env['ENV_TYPE'])
update_images(env=env)
update_images(env=env, node_type=node_type)

compose_up(env=env, node_type=node_type)

Expand Down Expand Up @@ -292,7 +292,7 @@ def init_mirage_boot(env_filepath: str, env: dict) -> None:
distro.id(),
distro.version(),
)
update_images(env=env)
update_images(env=env, node_type=NodeType.MIRAGE)

compose_up(env=env, node_type=NodeType.MIRAGE, is_mirage_boot=True)

Expand Down Expand Up @@ -345,7 +345,7 @@ def init_sync(
ts = int(time.time())
update_node_cli_schain_status(schain_name, repair_ts=ts, snapshot_from=snapshot_from)

update_images(env=env, sync_node=True)
update_images(env=env, node_type=NodeType.SYNC)

compose_up(env=env, node_type=NodeType.SYNC)

Expand Down Expand Up @@ -377,7 +377,7 @@ def update_sync(env_filepath: str, env: Dict) -> bool:
distro.id(),
distro.version(),
)
update_images(env=env, sync_node=True)
update_images(env=env, node_type=NodeType.SYNC)

compose_up(env=env, node_type=NodeType.SYNC)
return True
Expand Down
7 changes: 4 additions & 3 deletions node_cli/operations/skale_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,18 @@
from node_cli.utils.git_utils import clone_repo
from node_cli.utils.docker_utils import compose_pull, compose_build
from node_cli.configs import CONTAINER_CONFIG_PATH, CONTAINER_CONFIG_TMP_PATH, SKALE_NODE_REPO_URL
from node_cli.utils.node_type import NodeType


logger = logging.getLogger(__name__)


def update_images(env: dict, sync_node: bool = False) -> None:
def update_images(env: dict, node_type: NodeType) -> None:
local = env.get('CONTAINER_CONFIGS_DIR') != ''
if local:
compose_build(env=env, sync_node=sync_node)
compose_build(env=env, node_type=node_type)
else:
compose_pull(env=env, sync_node=sync_node)
compose_pull(env=env, node_type=node_type)


def download_skale_node(stream: Optional[str] = None, src: Optional[str] = None) -> None:
Expand Down
8 changes: 4 additions & 4 deletions node_cli/utils/docker_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,15 +268,15 @@ def compose_rm(node_type: NodeType, env={}):
logger.info('Compose containers removed')


def compose_pull(env: dict, sync_node: bool = False):
def compose_pull(env: dict, node_type: NodeType):
logger.info('Pulling compose containers')
compose_path = get_compose_path(NodeType.SYNC)
compose_path = get_compose_path(node_type)
run_cmd(cmd=('docker', 'compose', '-f', compose_path, 'pull'), env=env)


def compose_build(env: dict, sync_node: bool = False):
def compose_build(env: dict, node_type: NodeType):
logger.info('Building compose containers')
compose_path = get_compose_path(NodeType.SYNC)
compose_path = get_compose_path(node_type)
run_cmd(cmd=('docker', 'compose', '-f', compose_path, 'build'), env=env)


Expand Down
Loading