1
0
Fork 0
mirror of https://github.com/yavook/kiwi-scp.git synced 2024-11-22 12:53:00 +00:00
kiwi-scp/kiwi_scp/commands/cmd_up.py

33 lines
1,013 B
Python
Raw Normal View History

2021-11-27 17:13:31 +00:00
from typing import List
import click
from .cli import KiwiCommand, KiwiCommandType
from .decorators import kiwi_command
from ..executable import COMPOSE_EXE
2021-11-27 17:33:46 +00:00
from ..instance import Instance, Project, Services
2021-11-27 17:13:31 +00:00
@kiwi_command(
cmd_type=KiwiCommandType.SERVICE,
short_help="Bring up kiwi services",
)
class UpCommand(KiwiCommand):
"""Bring up the whole instance, a project or service(s) inside a project"""
@classmethod
2021-11-27 17:33:46 +00:00
def run_for_filtered_services(cls, instance: Instance, project: Project, services: Services,
new_service_names: List[str], **kwargs) -> None:
2021-11-27 17:13:31 +00:00
# TODO conf-copy
# TODO net-up
2021-11-27 17:33:46 +00:00
if not services:
2021-11-27 17:13:31 +00:00
if not click.confirm(
"Did not find any of those services. \n"
f"Bring up the entire project {project.name} instead?",
default=True
):
return
2021-11-27 17:33:46 +00:00
COMPOSE_EXE.run(["up", "-d", *services.names], **project.process_kwargs)