mirror of
https://github.com/yavook/kiwi-scp.git
synced 2024-11-22 04:43:00 +00:00
"config" -> "init", "inspect" -> "show", removed "purge" (integrated into instance's "down")
This commit is contained in:
parent
fc2c9cb04e
commit
ffe1089718
6 changed files with 39 additions and 21 deletions
|
@ -3,11 +3,10 @@ Commands for Operation:
|
||||||
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
|
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:
|
Commands for Instance Management:
|
||||||
config Create or configure kiwi-config instance
|
init Initialize or reconfigure kiwi-config instance
|
||||||
inspect Inspect projects in this instance, services inside a project or service(s) inside a project
|
show Show projects in this instance, services inside a project or service(s) inside a project
|
||||||
cmd Run raw docker-compose command in a project
|
cmd Run raw docker-compose command in a project
|
||||||
|
|
||||||
Commands for Project and Service Management:
|
Commands for Project and Service Management:
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
kiwi-config is the tool for container server management.
|
kiwi-config is the simple tool for managing container servers.
|
||||||
|
|
||||||
Features:
|
Features:
|
||||||
- Group services into projects using their own docker-compose.yml
|
- Group services into projects using their own docker-compose.yml
|
||||||
|
|
|
@ -3,18 +3,17 @@ from ._hidden import ConfCopyCommand, NetUpCommand
|
||||||
|
|
||||||
from .build import BuildCommand
|
from .build import BuildCommand
|
||||||
from .cmd import CmdCommand
|
from .cmd import CmdCommand
|
||||||
from .config import ConfigCommand
|
|
||||||
from .disable import DisableCommand
|
from .disable import DisableCommand
|
||||||
from .down import DownCommand
|
from .down import DownCommand
|
||||||
from .enable import EnableCommand
|
from .enable import EnableCommand
|
||||||
from .inspect import InspectCommand
|
from .init import InitCommand
|
||||||
from .logs import LogsCommand
|
from .logs import LogsCommand
|
||||||
from .new import NewCommand
|
from .new import NewCommand
|
||||||
from .pull import PullCommand
|
from .pull import PullCommand
|
||||||
from .purge import PurgeCommand
|
|
||||||
from .push import PushCommand
|
from .push import PushCommand
|
||||||
from .restart import RestartCommand
|
from .restart import RestartCommand
|
||||||
from .shell import ShellCommand
|
from .shell import ShellCommand
|
||||||
|
from .show import ShowCommand
|
||||||
from .up import UpCommand
|
from .up import UpCommand
|
||||||
from .update import UpdateCommand
|
from .update import UpdateCommand
|
||||||
|
|
||||||
|
@ -24,18 +23,17 @@ __all__ = [
|
||||||
|
|
||||||
'BuildCommand',
|
'BuildCommand',
|
||||||
'CmdCommand',
|
'CmdCommand',
|
||||||
'ConfigCommand',
|
|
||||||
'DisableCommand',
|
'DisableCommand',
|
||||||
'DownCommand',
|
'DownCommand',
|
||||||
'EnableCommand',
|
'EnableCommand',
|
||||||
'InspectCommand',
|
'InitCommand',
|
||||||
'LogsCommand',
|
'LogsCommand',
|
||||||
'NewCommand',
|
'NewCommand',
|
||||||
'PullCommand',
|
'PullCommand',
|
||||||
'PurgeCommand',
|
|
||||||
'PushCommand',
|
'PushCommand',
|
||||||
'RestartCommand',
|
'RestartCommand',
|
||||||
'ShellCommand',
|
'ShellCommand',
|
||||||
|
'ShowCommand',
|
||||||
'UpCommand',
|
'UpCommand',
|
||||||
'UpdateCommand',
|
'UpdateCommand',
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,5 +1,12 @@
|
||||||
|
# system
|
||||||
|
import logging
|
||||||
|
import subprocess
|
||||||
|
|
||||||
# local
|
# local
|
||||||
|
from ._hidden import _find_net
|
||||||
from ..subcommand import ServiceCommand
|
from ..subcommand import ServiceCommand
|
||||||
|
from ..config import LoadedConfig
|
||||||
|
from ..executable import Executable
|
||||||
from ..misc import are_you_sure
|
from ..misc import are_you_sure
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,13 +21,27 @@ class DownCommand(ServiceCommand):
|
||||||
)
|
)
|
||||||
|
|
||||||
def _run_instance(self, runner, args):
|
def _run_instance(self, runner, args):
|
||||||
|
net_name = LoadedConfig.get()['network:name']
|
||||||
|
|
||||||
if are_you_sure([
|
if are_you_sure([
|
||||||
"This will bring down the entire instance.",
|
"This will bring down the entire instance.",
|
||||||
"",
|
"",
|
||||||
"This may not be what you intended, because:",
|
"This may not be what you intended, because:",
|
||||||
" - Bringing down the instance stops ALL services in here",
|
" - Bringing down the instance stops ALL services in here",
|
||||||
]):
|
]):
|
||||||
return super()._run_instance(runner, args)
|
if super()._run_instance(runner, args):
|
||||||
|
# remove the hub network afterwards
|
||||||
|
if _find_net(net_name):
|
||||||
|
Executable('docker').run([
|
||||||
|
'network', 'rm', net_name
|
||||||
|
], check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
||||||
|
|
||||||
|
logging.info(f"Network '{net_name}' removed")
|
||||||
|
|
||||||
|
else:
|
||||||
|
logging.info(f"Network '{net_name}' does not exist")
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
|
@ -8,14 +8,14 @@ from ..subcommand import SubCommand
|
||||||
from ..config import DefaultConfig, LoadedConfig
|
from ..config import DefaultConfig, LoadedConfig
|
||||||
|
|
||||||
|
|
||||||
class ConfigCommand(SubCommand):
|
class InitCommand(SubCommand):
|
||||||
"""kiwi config"""
|
"""kiwi init"""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__(
|
super().__init__(
|
||||||
'config',
|
'init',
|
||||||
action=f"Configuring '{KIWI_CONF_NAME}' in",
|
action=f"Initializing '{KIWI_CONF_NAME}' in",
|
||||||
description="Create or configure kiwi-config instance"
|
description="Initialize or reconfigure kiwi-config instance"
|
||||||
)
|
)
|
||||||
|
|
||||||
# -f switch: Initialize with default config
|
# -f switch: Initialize with default config
|
|
@ -24,14 +24,14 @@ def _print_list(strings):
|
||||||
_print_list(list(strings))
|
_print_list(list(strings))
|
||||||
|
|
||||||
|
|
||||||
class InspectCommand(ServiceCommand):
|
class ShowCommand(ServiceCommand):
|
||||||
"""kiwi inspect"""
|
"""kiwi show"""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__(
|
super().__init__(
|
||||||
'inspect', num_projects='?', num_services='*',
|
'show', num_projects='?', num_services='*',
|
||||||
action="Inspecting",
|
action="Showing",
|
||||||
description="Inspect projects in this instance, services inside a project or service(s) inside a project"
|
description="Show projects in this instance, services inside a project or service(s) inside a project"
|
||||||
)
|
)
|
||||||
|
|
||||||
def _run_instance(self, runner, args):
|
def _run_instance(self, runner, args):
|
Loading…
Reference in a new issue