dependencies
This commit is contained in:
parent
79520c2a63
commit
2acbc1c534
2 changed files with 18 additions and 11 deletions
|
@ -5,6 +5,7 @@ import subprocess
|
||||||
# local
|
# local
|
||||||
from ._subcommand import SubCommand
|
from ._subcommand import SubCommand
|
||||||
from .utils.dockercommand import DockerCommand
|
from .utils.dockercommand import DockerCommand
|
||||||
|
from .utils.user_input import are_you_sure
|
||||||
|
|
||||||
|
|
||||||
def _find_net(config, args):
|
def _find_net(config, args):
|
||||||
|
@ -65,6 +66,9 @@ class NetDownCommand(SubCommand):
|
||||||
return
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
if are_you_sure("This will bring down this instance's hub network!"):
|
||||||
|
runner.run('down')
|
||||||
|
|
||||||
DockerCommand('docker').run(
|
DockerCommand('docker').run(
|
||||||
config, args,
|
config, args,
|
||||||
['network', 'rm', config['network:name']],
|
['network', 'rm', config['network:name']],
|
||||||
|
|
|
@ -4,7 +4,7 @@ import logging
|
||||||
# local
|
# local
|
||||||
from ._subcommand import ServiceCommand
|
from ._subcommand import ServiceCommand
|
||||||
from .utils.dockercommand import DockerCommand
|
from .utils.dockercommand import DockerCommand
|
||||||
from .utils.project import list_projects
|
from .utils.project import get_project_name, list_projects
|
||||||
|
|
||||||
|
|
||||||
class UpCommand(ServiceCommand):
|
class UpCommand(ServiceCommand):
|
||||||
|
@ -13,20 +13,23 @@ class UpCommand(ServiceCommand):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__(
|
super().__init__(
|
||||||
'up', num_projects='?', num_services='*',
|
'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):
|
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
|
# "up" for all projects
|
||||||
for project_name in list_projects(config):
|
for project_name in list_projects(config):
|
||||||
logging.info(f"Bringing up project '{project_name}'")
|
|
||||||
args.projects = project_name
|
args.projects = project_name
|
||||||
|
|
||||||
runner.run('up')
|
runner.run('up')
|
||||||
|
|
||||||
return
|
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')
|
runner.run('net-up')
|
||||||
DockerCommand('docker-compose').run(
|
DockerCommand('docker-compose').run(
|
||||||
config, args, ['up', '-d', *args.services]
|
config, args, ['up', '-d', *args.services]
|
||||||
|
|
Loading…
Reference in a new issue