1
0
Fork 0
mirror of https://github.com/yavook/kiwi-scp.git synced 2024-11-21 20:33:00 +00:00

dependencies

This commit is contained in:
Jörn-Michael Miehe 2020-08-17 14:51:43 +02:00
parent 79520c2a63
commit 2acbc1c534
2 changed files with 18 additions and 11 deletions

View file

@ -5,6 +5,7 @@ import subprocess
# local
from ._subcommand import SubCommand
from .utils.dockercommand import DockerCommand
from .utils.user_input import are_you_sure
def _find_net(config, args):
@ -65,12 +66,15 @@ class NetDownCommand(SubCommand):
return
try:
DockerCommand('docker').run(
config, args,
['network', 'rm', config['network:name']],
check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL
)
logging.info(f"Network '{config['network:name']}' removed")
if are_you_sure("This will bring down this instance's hub network!"):
runner.run('down')
DockerCommand('docker').run(
config, args,
['network', 'rm', config['network:name']],
check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL
)
logging.info(f"Network '{config['network:name']}' removed")
except subprocess.CalledProcessError:
logging.error(f"Error removing network '{config['network:name']}'")

View file

@ -4,7 +4,7 @@ import logging
# local
from ._subcommand import ServiceCommand
from .utils.dockercommand import DockerCommand
from .utils.project import list_projects
from .utils.project import get_project_name, list_projects
class UpCommand(ServiceCommand):
@ -13,20 +13,23 @@ class UpCommand(ServiceCommand):
def __init__(self):
super().__init__(
'up', num_projects='?', num_services='*',
description="Start the whole instance, a project or service(s) inside a project"
description="Bring up the whole instance, a project or service(s) inside a project"
)
def run(self, runner, config, args):
if args.projects is None:
if 'projects' not in args or args.projects is None:
# "up" for all projects
for project_name in list_projects(config):
logging.info(f"Bringing up project '{project_name}'")
args.projects = project_name
runner.run('up')
return
if 'services' in args and args.services:
logging.info(f"Bringing up services {args.services} in project '{get_project_name(args)}'")
else:
logging.info(f"Bringing up project '{get_project_name(args)}'")
runner.run('net-up')
DockerCommand('docker-compose').run(
config, args, ['up', '-d', *args.services]