2020-08-17 12:12:33 +00:00
|
|
|
# local
|
2020-08-19 14:10:56 +00:00
|
|
|
from ._subcommand import ServiceCommand
|
2020-08-17 12:12:33 +00:00
|
|
|
from .utils.dockercommand import DockerCommand
|
|
|
|
|
|
|
|
|
2020-08-19 14:10:56 +00:00
|
|
|
class UpCommand(ServiceCommand):
|
2020-08-17 12:12:33 +00:00
|
|
|
"""kiwi up"""
|
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
super().__init__(
|
2020-08-19 14:10:56 +00:00
|
|
|
'up', num_projects='?', num_services='*',
|
|
|
|
action="Bringing up",
|
2020-08-18 12:18:54 +00:00
|
|
|
description="Bring up the whole instance, a project or service(s) inside a project"
|
2020-08-17 12:12:33 +00:00
|
|
|
)
|
|
|
|
|
2020-08-19 14:10:56 +00:00
|
|
|
def _run_instance(self, runner, args):
|
2020-08-18 14:02:45 +00:00
|
|
|
if runner.run('conf-copy'):
|
2020-08-19 14:10:56 +00:00
|
|
|
return super()._run_instance(runner, args)
|
2020-08-18 14:02:45 +00:00
|
|
|
|
|
|
|
return False
|
|
|
|
|
2020-08-19 14:10:56 +00:00
|
|
|
def _run_services(self, runner, args, project, services):
|
2020-08-18 12:23:56 +00:00
|
|
|
if runner.run('net-up'):
|
2020-08-19 14:10:56 +00:00
|
|
|
DockerCommand('docker-compose').run(project, [
|
|
|
|
'up', '-d', *services
|
|
|
|
])
|
2020-08-18 12:23:56 +00:00
|
|
|
return True
|
|
|
|
|
|
|
|
return False
|