"run_for_existing_project" -> "run_for_project"
This commit is contained in:
parent
3e52ba6e12
commit
7afd540062
5 changed files with 11 additions and 11 deletions
|
@ -122,17 +122,17 @@ class KiwiCommand:
|
|||
def run_for_instance(cls, instance: Instance, **kwargs) -> None:
|
||||
for project_config in instance.config.projects:
|
||||
project = instance.get_project(project_config.name)
|
||||
cls.run_for_existing_project(instance, project, **kwargs)
|
||||
cls.run_for_project(instance, project, **kwargs)
|
||||
|
||||
@classmethod
|
||||
def run_for_project(cls, instance: Instance, project: Project, **kwargs) -> None:
|
||||
service_names = [service.name for service in project.services.content]
|
||||
cls.run_for_services(instance, project, service_names, **kwargs)
|
||||
|
||||
@classmethod
|
||||
def run_for_new_project(cls, instance: Instance, project_name: str, **kwargs) -> None:
|
||||
cls.print_error(f"Project '{project_name}' not in kiwi-scp instance at '{instance.directory}'!")
|
||||
|
||||
@classmethod
|
||||
def run_for_existing_project(cls, instance: Instance, project: Project, **kwargs) -> None:
|
||||
service_names = [service.name for service in project.services.content]
|
||||
cls.run_for_services(instance, project, service_names, **kwargs)
|
||||
|
||||
@classmethod
|
||||
def run_for_services(cls, instance: Instance, project: Project, service_names: List[str], **kwargs) -> None:
|
||||
raise Exception
|
||||
|
|
|
@ -28,7 +28,7 @@ class CmdCommand(KiwiCommand):
|
|||
"""Run raw docker-compose command in a project"""
|
||||
|
||||
@classmethod
|
||||
def run_for_existing_project(cls, instance: Instance, project: Project, compose_cmd: str = None,
|
||||
def run_for_project(cls, instance: Instance, project: Project, compose_cmd: str = None,
|
||||
compose_args: Tuple[str] = None) -> None:
|
||||
if project.project_config.enabled:
|
||||
COMPOSE_EXE.run([compose_cmd, *compose_args], **project.process_kwargs)
|
||||
|
|
|
@ -36,7 +36,7 @@ class DownCommand(KiwiCommand):
|
|||
# TODO net-down
|
||||
|
||||
@classmethod
|
||||
def run_for_existing_project(cls, instance: Instance, project: Project, **kwargs) -> None:
|
||||
def run_for_project(cls, instance: Instance, project: Project, **kwargs) -> None:
|
||||
COMPOSE_EXE.run(["down"], **project.process_kwargs)
|
||||
|
||||
@classmethod
|
||||
|
|
|
@ -33,7 +33,7 @@ class ListCommand(KiwiCommand):
|
|||
)
|
||||
|
||||
@classmethod
|
||||
def run_for_existing_project(cls, instance: Instance, project: Project, show: bool = None) -> None:
|
||||
def run_for_project(cls, instance: Instance, project: Project, show: bool = None) -> None:
|
||||
if show:
|
||||
KiwiCommand.print_header(f"Showing config for all services in project '{project.name}'.")
|
||||
click.echo_via_pager(str(project.services))
|
||||
|
|
|
@ -53,7 +53,7 @@ def kiwi_command(
|
|||
project = ctx.get_project(project_name)
|
||||
if project is not None:
|
||||
_logger.debug(f"running for existing project {project}, kwargs={kwargs}")
|
||||
command_cls.run_for_existing_project(ctx, project, **kwargs)
|
||||
command_cls.run_for_project(ctx, project, **kwargs)
|
||||
|
||||
else:
|
||||
_logger.debug(f"running for new project {project_name}, kwargs={kwargs}")
|
||||
|
|
Loading…
Reference in a new issue