"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
|
||||
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:
|
||||
config Create or configure kiwi-config instance
|
||||
inspect Inspect projects in this instance, services inside a project or service(s) inside a project
|
||||
init Initialize or reconfigure kiwi-config instance
|
||||
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
|
||||
|
||||
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:
|
||||
- Group services into projects using their own docker-compose.yml
|
||||
|
|
|
@ -3,18 +3,17 @@ from ._hidden import ConfCopyCommand, NetUpCommand
|
|||
|
||||
from .build import BuildCommand
|
||||
from .cmd import CmdCommand
|
||||
from .config import ConfigCommand
|
||||
from .disable import DisableCommand
|
||||
from .down import DownCommand
|
||||
from .enable import EnableCommand
|
||||
from .inspect import InspectCommand
|
||||
from .init import InitCommand
|
||||
from .logs import LogsCommand
|
||||
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 .show import ShowCommand
|
||||
from .up import UpCommand
|
||||
from .update import UpdateCommand
|
||||
|
||||
|
@ -24,18 +23,17 @@ __all__ = [
|
|||
|
||||
'BuildCommand',
|
||||
'CmdCommand',
|
||||
'ConfigCommand',
|
||||
'DisableCommand',
|
||||
'DownCommand',
|
||||
'EnableCommand',
|
||||
'InspectCommand',
|
||||
'InitCommand',
|
||||
'LogsCommand',
|
||||
'NewCommand',
|
||||
'PullCommand',
|
||||
'PurgeCommand',
|
||||
'PushCommand',
|
||||
'RestartCommand',
|
||||
'ShellCommand',
|
||||
'ShowCommand',
|
||||
'UpCommand',
|
||||
'UpdateCommand',
|
||||
]
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
# system
|
||||
import logging
|
||||
import subprocess
|
||||
|
||||
# local
|
||||
from ._hidden import _find_net
|
||||
from ..subcommand import ServiceCommand
|
||||
from ..config import LoadedConfig
|
||||
from ..executable import Executable
|
||||
from ..misc import are_you_sure
|
||||
|
||||
|
||||
|
@ -14,13 +21,27 @@ class DownCommand(ServiceCommand):
|
|||
)
|
||||
|
||||
def _run_instance(self, runner, args):
|
||||
net_name = LoadedConfig.get()['network:name']
|
||||
|
||||
if are_you_sure([
|
||||
"This will bring down the entire instance.",
|
||||
"",
|
||||
"This may not be what you intended, because:",
|
||||
" - 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
|
||||
|
||||
|
|
|
@ -8,14 +8,14 @@ from ..subcommand import SubCommand
|
|||
from ..config import DefaultConfig, LoadedConfig
|
||||
|
||||
|
||||
class ConfigCommand(SubCommand):
|
||||
"""kiwi config"""
|
||||
class InitCommand(SubCommand):
|
||||
"""kiwi init"""
|
||||
|
||||
def __init__(self):
|
||||
super().__init__(
|
||||
'config',
|
||||
action=f"Configuring '{KIWI_CONF_NAME}' in",
|
||||
description="Create or configure kiwi-config instance"
|
||||
'init',
|
||||
action=f"Initializing '{KIWI_CONF_NAME}' in",
|
||||
description="Initialize or reconfigure kiwi-config instance"
|
||||
)
|
||||
|
||||
# -f switch: Initialize with default config
|
|
@ -24,14 +24,14 @@ def _print_list(strings):
|
|||
_print_list(list(strings))
|
||||
|
||||
|
||||
class InspectCommand(ServiceCommand):
|
||||
"""kiwi inspect"""
|
||||
class ShowCommand(ServiceCommand):
|
||||
"""kiwi show"""
|
||||
|
||||
def __init__(self):
|
||||
super().__init__(
|
||||
'inspect', num_projects='?', num_services='*',
|
||||
action="Inspecting",
|
||||
description="Inspect projects in this instance, services inside a project or service(s) inside a project"
|
||||
'show', num_projects='?', num_services='*',
|
||||
action="Showing",
|
||||
description="Show projects in this instance, services inside a project or service(s) inside a project"
|
||||
)
|
||||
|
||||
def _run_instance(self, runner, args):
|
Loading…
Reference in a new issue