mirror of
https://github.com/yavook/kiwi-scp.git
synced 2024-11-21 20:33:00 +00:00
Subcommand "restart"
This commit is contained in:
parent
268188090b
commit
fc2c9cb04e
3 changed files with 29 additions and 0 deletions
|
@ -2,6 +2,7 @@ Commands for Operation:
|
||||||
up Bring up the whole instance, a project or service(s) inside a project
|
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
|
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
|
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
|
purge Remove all running docker artifacts of this instance
|
||||||
|
|
||||||
Commands for Instance Management:
|
Commands for Instance Management:
|
||||||
|
|
|
@ -13,6 +13,7 @@ from .new import NewCommand
|
||||||
from .pull import PullCommand
|
from .pull import PullCommand
|
||||||
from .purge import PurgeCommand
|
from .purge import PurgeCommand
|
||||||
from .push import PushCommand
|
from .push import PushCommand
|
||||||
|
from .restart import RestartCommand
|
||||||
from .shell import ShellCommand
|
from .shell import ShellCommand
|
||||||
from .up import UpCommand
|
from .up import UpCommand
|
||||||
from .update import UpdateCommand
|
from .update import UpdateCommand
|
||||||
|
@ -33,6 +34,7 @@ __all__ = [
|
||||||
'PullCommand',
|
'PullCommand',
|
||||||
'PurgeCommand',
|
'PurgeCommand',
|
||||||
'PushCommand',
|
'PushCommand',
|
||||||
|
'RestartCommand',
|
||||||
'ShellCommand',
|
'ShellCommand',
|
||||||
'UpCommand',
|
'UpCommand',
|
||||||
'UpdateCommand',
|
'UpdateCommand',
|
||||||
|
|
26
src/kiwi/subcommands/restart.py
Normal file
26
src/kiwi/subcommands/restart.py
Normal 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
|
Loading…
Reference in a new issue