1
0
Fork 0
mirror of https://github.com/yavook/kiwi-scp.git synced 2024-11-24 21:52:59 +00:00
kiwi-scp/kiwi_scp/subcommands/restart.py

27 lines
738 B
Python
Raw Normal View History

2020-08-25 13:42:53 +00:00
# local
from ..misc import are_you_sure
2021-09-22 01:06:43 +00:00
from ..subcommand import ServiceCommand
2020-08-25 13:42:53 +00:00
class RestartCommand(ServiceCommand):
"""kiwi restart"""
def __init__(self):
super().__init__(
'restart', num_projects='?', num_services='*',
action="Restarting",
description="Restart the whole instance, a project or service(s) inside a project"
)
def _run_instance(self, runner, args):
if are_you_sure([
"This will restart the entire instance."
]):
return super()._run_instance(runner, args)
return False
def _run_services(self, runner, args, project, services):
project.compose_run(['restart', *services])
return True