mirror of
https://github.com/yavook/kiwi-scp.git
synced 2024-11-22 04:43:00 +00:00
update command import pattern
This commit is contained in:
parent
3862ea1901
commit
cce894b942
1 changed files with 22 additions and 5 deletions
|
@ -4,6 +4,10 @@ import click
|
||||||
from click import get_current_context
|
from click import get_current_context
|
||||||
|
|
||||||
from .cmd import KiwiCommandType, KiwiCommand
|
from .cmd import KiwiCommandType, KiwiCommand
|
||||||
|
from .cmd_build import BuildCommand
|
||||||
|
from .cmd_down import DownCommand
|
||||||
|
from .cmd_pull import PullCommand
|
||||||
|
from .cmd_up import UpCommand
|
||||||
from .decorators import kiwi_command
|
from .decorators import kiwi_command
|
||||||
from ..instance import Instance
|
from ..instance import Instance
|
||||||
from ..project import Project
|
from ..project import Project
|
||||||
|
@ -24,6 +28,20 @@ class UpdateCommand(KiwiCommand):
|
||||||
type = KiwiCommandType.SERVICES
|
type = KiwiCommandType.SERVICES
|
||||||
enabled_only = True
|
enabled_only = True
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def run_for_instance(cls, instance: Instance, force: bool = None) -> None:
|
||||||
|
if not force:
|
||||||
|
if not KiwiCommand.danger_confirm(
|
||||||
|
"This will update the entire instance at once.",
|
||||||
|
"",
|
||||||
|
"This may not be what you intended, because:",
|
||||||
|
" - Updates may take a long time",
|
||||||
|
" - Updates may break beloved functionality",
|
||||||
|
):
|
||||||
|
return
|
||||||
|
|
||||||
|
super().run_for_instance(instance)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run_for_filtered_services(cls, instance: Instance, project: Project, services: Services,
|
def run_for_filtered_services(cls, instance: Instance, project: Project, services: Services,
|
||||||
new_service_names: List[str], **kwargs) -> None:
|
new_service_names: List[str], **kwargs) -> None:
|
||||||
|
@ -35,14 +53,13 @@ class UpdateCommand(KiwiCommand):
|
||||||
):
|
):
|
||||||
return
|
return
|
||||||
|
|
||||||
from .cmd_build import BuildCommand
|
|
||||||
from .cmd_down import DownCommand
|
|
||||||
from .cmd_pull import PullCommand
|
|
||||||
from .cmd_up import UpCommand
|
|
||||||
|
|
||||||
ctx = get_current_context()
|
ctx = get_current_context()
|
||||||
|
assert isinstance(BuildCommand, click.Command)
|
||||||
ctx.forward(BuildCommand)
|
ctx.forward(BuildCommand)
|
||||||
|
assert isinstance(PullCommand, click.Command)
|
||||||
ctx.forward(PullCommand)
|
ctx.forward(PullCommand)
|
||||||
# TODO conf-copy
|
# TODO conf-copy
|
||||||
|
assert isinstance(DownCommand, click.Command)
|
||||||
ctx.forward(DownCommand)
|
ctx.forward(DownCommand)
|
||||||
|
assert isinstance(UpCommand, click.Command)
|
||||||
ctx.forward(UpCommand)
|
ctx.forward(UpCommand)
|
||||||
|
|
Loading…
Reference in a new issue