1
0
Fork 0
mirror of https://github.com/yavook/kiwi-scp.git synced 2024-11-22 21:03:00 +00:00
kiwi-scp/src/kiwi/subcommands/up.py
2020-08-17 14:13:02 +02:00

33 lines
898 B
Python

# system
import logging
# local
from ._subcommand import ServiceCommand
from .utils.dockercommand import DockerCommand
from .utils.project import list_projects
class UpCommand(ServiceCommand):
"""kiwi up"""
def __init__(self):
super().__init__(
'up', num_projects='?', num_services='*',
description="Start the whole instance, a project or service(s) inside a project"
)
def run(self, runner, config, args):
if args.projects is None:
# "up" for all projects
for project_name in list_projects(config):
logging.info(f"Bringing up project '{project_name}'")
args.projects = project_name
runner.run('up')
return
runner.run('net-up')
DockerCommand('docker-compose').run(
config, args, ['up', '-d', *args.services]
)