mirror of
https://github.com/yavook/kiwi-scp.git
synced 2024-11-22 04:43:00 +00:00
remove legacy
This commit is contained in:
parent
fc35e4525b
commit
64138abb92
2 changed files with 0 additions and 82 deletions
|
@ -1,45 +0,0 @@
|
||||||
# system
|
|
||||||
import logging
|
|
||||||
import subprocess
|
|
||||||
|
|
||||||
# local
|
|
||||||
from ._hidden import _find_net
|
|
||||||
from ..config import LoadedConfig
|
|
||||||
from ..executable import Executable
|
|
||||||
from ..misc import are_you_sure
|
|
||||||
from ..subcommand import SubCommand
|
|
||||||
|
|
||||||
|
|
||||||
class PurgeCommand(SubCommand):
|
|
||||||
"""kiwi purge"""
|
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
super().__init__(
|
|
||||||
'purge',
|
|
||||||
action="Tearing down",
|
|
||||||
description="Remove all running docker artifacts of this instance"
|
|
||||||
)
|
|
||||||
|
|
||||||
def _run_instance(self, runner, args):
|
|
||||||
net_name = LoadedConfig.get()['network:name']
|
|
||||||
|
|
||||||
if not _find_net(net_name):
|
|
||||||
logging.info(f"Network '{net_name}' does not exist")
|
|
||||||
return True
|
|
||||||
|
|
||||||
try:
|
|
||||||
if are_you_sure("This will bring down this instance's hub network!"):
|
|
||||||
if runner.run('down'):
|
|
||||||
Executable('docker').run([
|
|
||||||
'network', 'rm', net_name
|
|
||||||
], check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
|
||||||
|
|
||||||
logging.info(f"Network '{net_name}' removed")
|
|
||||||
else:
|
|
||||||
return False
|
|
||||||
|
|
||||||
except subprocess.CalledProcessError:
|
|
||||||
logging.error(f"Error removing network '{net_name}'")
|
|
||||||
return False
|
|
||||||
|
|
||||||
return True
|
|
|
@ -1,37 +0,0 @@
|
||||||
# local
|
|
||||||
from ..misc import are_you_sure
|
|
||||||
from ..subcommand import ServiceCommand
|
|
||||||
|
|
||||||
|
|
||||||
class UpdateCommand(ServiceCommand):
|
|
||||||
"""kiwi update"""
|
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
super().__init__(
|
|
||||||
'update', num_projects='?', num_services='*',
|
|
||||||
action="Updating",
|
|
||||||
description="Update the whole instance, a project or service(s) inside a project"
|
|
||||||
)
|
|
||||||
|
|
||||||
def _run_instance(self, runner, args):
|
|
||||||
if are_you_sure([
|
|
||||||
"This will update the entire instance at once.",
|
|
||||||
"",
|
|
||||||
"This is probably not what you intended, because:",
|
|
||||||
" - Updates may take a long time",
|
|
||||||
" - Updates may break beloved functionality",
|
|
||||||
]):
|
|
||||||
return super()._run_instance(runner, args)
|
|
||||||
|
|
||||||
return False
|
|
||||||
|
|
||||||
def _run_services(self, runner, args, project, services):
|
|
||||||
result = True
|
|
||||||
|
|
||||||
result &= runner.run('build')
|
|
||||||
result &= runner.run('pull')
|
|
||||||
result &= runner.run('conf-copy')
|
|
||||||
result &= runner.run('down')
|
|
||||||
result &= runner.run('up')
|
|
||||||
|
|
||||||
return result
|
|
Loading…
Reference in a new issue