1
0
Fork 0
mirror of https://github.com/yavook/kiwi-scp.git synced 2024-12-25 18:42:59 +00:00

Subcommand "restart"

This commit is contained in:
Jörn-Michael Miehe 2020-08-25 15:42:53 +02:00
parent 268188090b
commit fc2c9cb04e
3 changed files with 29 additions and 0 deletions

View file

@ -2,6 +2,7 @@ Commands for Operation:
up Bring up the whole instance, a project or service(s) inside a project
down Bring down the whole instance, a project or service(s) inside a project
update Update the whole instance, a project or service(s) inside a project
restart Restart the whole instance, a project or service(s) inside a project
purge Remove all running docker artifacts of this instance
Commands for Instance Management:

View file

@ -13,6 +13,7 @@ from .new import NewCommand
from .pull import PullCommand
from .purge import PurgeCommand
from .push import PushCommand
from .restart import RestartCommand
from .shell import ShellCommand
from .up import UpCommand
from .update import UpdateCommand
@ -33,6 +34,7 @@ __all__ = [
'PullCommand',
'PurgeCommand',
'PushCommand',
'RestartCommand',
'ShellCommand',
'UpCommand',
'UpdateCommand',

View file

@ -0,0 +1,26 @@
# local
from ..subcommand import ServiceCommand
from ..misc import are_you_sure
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