forked from cerc-io/stack-orchestrator
More click refactoring
This commit is contained in:
parent
2fadafbd87
commit
397866f18b
BIN
app/__pycache__/__init__.cpython-38.pyc
Normal file
BIN
app/__pycache__/__init__.cpython-38.pyc
Normal file
Binary file not shown.
BIN
app/__pycache__/__init__.cpython-39.pyc
Normal file
BIN
app/__pycache__/__init__.cpython-39.pyc
Normal file
Binary file not shown.
BIN
app/__pycache__/build_containers.cpython-38.pyc
Normal file
BIN
app/__pycache__/build_containers.cpython-38.pyc
Normal file
Binary file not shown.
BIN
app/__pycache__/build_containers.cpython-39.pyc
Normal file
BIN
app/__pycache__/build_containers.cpython-39.pyc
Normal file
Binary file not shown.
BIN
app/__pycache__/deploy_system.cpython-38.pyc
Normal file
BIN
app/__pycache__/deploy_system.cpython-38.pyc
Normal file
Binary file not shown.
BIN
app/__pycache__/deploy_system.cpython-39.pyc
Normal file
BIN
app/__pycache__/deploy_system.cpython-39.pyc
Normal file
Binary file not shown.
BIN
app/__pycache__/setup_repositories.cpython-38.pyc
Normal file
BIN
app/__pycache__/setup_repositories.cpython-38.pyc
Normal file
Binary file not shown.
BIN
app/__pycache__/setup_repositories.cpython-39.pyc
Normal file
BIN
app/__pycache__/setup_repositories.cpython-39.pyc
Normal file
Binary file not shown.
@ -27,25 +27,28 @@ from decouple import config
|
||||
import subprocess
|
||||
import click
|
||||
|
||||
parser = argparse.ArgumentParser(
|
||||
description="build the set of containers required for a complete stack",
|
||||
epilog="Config provided either in .env or settings.ini or env vars: CERC_REPO_BASE_DIR (defaults to ~/cerc)"
|
||||
)
|
||||
parser.add_argument("--verbose", action="store_true", help="increase output verbosity")
|
||||
parser.add_argument("--quiet", action="store_true", help="don\'t print informational output")
|
||||
parser.add_argument("--check-only", action="store_true", help="looks at what\'s already there and checks if it looks good")
|
||||
parser.add_argument("--dry-run", action="store_true", help="don\'t do anything, just print the commands that would be executed")
|
||||
#parser = argparse.ArgumentParser(
|
||||
# description="build the set of containers required for a complete stack",
|
||||
# epilog="Config provided either in .env or settings.ini or env vars: CERC_REPO_BASE_DIR (defaults to ~/cerc)"
|
||||
# )
|
||||
#parser.add_argument("--verbose", action="store_true", help="increase output verbosity")
|
||||
#parser.add_argument("--quiet", action="store_true", help="don\'t print informational output")
|
||||
#parser.add_argument("--check-only", action="store_true", help="looks at what\'s already there and checks if it looks good")
|
||||
#parser.add_argument("--dry-run", action="store_true", help="don\'t do anything, just print the commands that would be executed")
|
||||
|
||||
args = parser.parse_args()
|
||||
#args = parser.parse_args()
|
||||
|
||||
@click.command()
|
||||
def command():
|
||||
verbose = args.verbose
|
||||
quiet = args.quiet
|
||||
@click.pass_context
|
||||
def command(ctx):
|
||||
|
||||
quiet = ctx.obj.quiet
|
||||
verbose = ctx.obj.verbose
|
||||
dry_run = ctx.obj.verbose
|
||||
|
||||
dev_root_path = os.path.expanduser(config("CERC_REPO_BASE_DIR", default="~/cerc"))
|
||||
|
||||
if not args.quiet:
|
||||
if not quiet:
|
||||
print(f'Dev Root is: {dev_root_path}')
|
||||
|
||||
if not os.path.isdir(dev_root_path):
|
||||
@ -66,7 +69,7 @@ def command():
|
||||
if not os.path.exists(build_script_filename):
|
||||
print(f"Error, script: {build_script_filename} doesn't exist")
|
||||
sys.exit(1)
|
||||
if not args.dry_run:
|
||||
if not dry_run:
|
||||
# We need to export CERC_REPO_BASE_DIR
|
||||
build_result = subprocess.run(build_script_filename, shell=True, env={'CERC_REPO_BASE_DIR':dev_root_path})
|
||||
# TODO: check result in build_result.returncode
|
||||
|
@ -51,7 +51,12 @@ def include_exclude_check(s, args):
|
||||
#print("Yo2!")
|
||||
|
||||
@click.command()
|
||||
def command():
|
||||
@click.pass_context
|
||||
def command(ctx):
|
||||
|
||||
quiet = ctx.obj.quiet
|
||||
verbose = ctx.obj.verbose
|
||||
dry_run = ctx.obj.verbose
|
||||
|
||||
with open("cluster-list.txt") as cluster_list_file:
|
||||
clusters = cluster_list_file.read().splitlines()
|
||||
@ -76,8 +81,8 @@ def command():
|
||||
# See: https://gabrieldemarmiesse.github.io/python-on-whales/sub-commands/compose/
|
||||
docker = DockerClient(compose_files=compose_files)
|
||||
|
||||
command = args.command[0]
|
||||
if not args.dry_run:
|
||||
command = "hack"
|
||||
if not dry_run:
|
||||
if command == "up":
|
||||
if verbose:
|
||||
print("Running compose up")
|
||||
|
Loading…
Reference in New Issue
Block a user