From 69b6b9a873b206a0571eea66a3aae95987edf811 Mon Sep 17 00:00:00 2001 From: David Boreham Date: Tue, 28 Feb 2023 08:47:02 -0700 Subject: [PATCH] Make cluster/docker-compose project name unique Former-commit-id: a1fdeac3b7d48d78437fe367fb36c4761c70c91e --- app/deploy_system.py | 7 +++++-- cli.py | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/deploy_system.py b/app/deploy_system.py index bff573bd..502e0126 100644 --- a/app/deploy_system.py +++ b/app/deploy_system.py @@ -151,10 +151,13 @@ def _make_cluster_context(ctx, include, exclude, cluster): compose_dir = Path(__file__).absolute().parent.joinpath("data", "compose") if cluster is None: - # Create default unique, stable cluster name from confile file path + # Create default unique, stable cluster name from confile file path and stack name if provided # TODO: change this to the config file path path = os.path.realpath(sys.argv[0]) - hash = hashlib.md5(path.encode()).hexdigest() + unique_cluster_descriptor = f"{path},{ctx.stack},{include},{exclude}" + if ctx.debug: + print(f"pre-hash descriptor: {unique_cluster_descriptor}") + hash = hashlib.md5(unique_cluster_descriptor.encode()).hexdigest() cluster = f"laconic-{hash}" if ctx.verbose: print(f"Using cluster name: {cluster}") diff --git a/cli.py b/cli.py index 04ecd738..72b3ba01 100644 --- a/cli.py +++ b/cli.py @@ -55,5 +55,6 @@ def cli(ctx, stack, quiet, verbose, dry_run, local_stack, debug, continue_on_err cli.add_command(setup_repositories.command, "setup-repositories") cli.add_command(build_containers.command, "build-containers") cli.add_command(build_npms.command, "build-npms") +cli.add_command(deploy_system.command, "deploy") # deploy is an alias for deploy-system cli.add_command(deploy_system.command, "deploy-system") cli.add_command(version.command, "version")