Merge pull request #196 from cerc-io/dboreham/fix-project-name
Make cluster/docker-compose project name unique
This commit is contained in:
commit
4353418fa6
@ -151,10 +151,13 @@ def _make_cluster_context(ctx, include, exclude, cluster):
|
|||||||
compose_dir = Path(__file__).absolute().parent.joinpath("data", "compose")
|
compose_dir = Path(__file__).absolute().parent.joinpath("data", "compose")
|
||||||
|
|
||||||
if cluster is None:
|
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
|
# TODO: change this to the config file path
|
||||||
path = os.path.realpath(sys.argv[0])
|
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}"
|
cluster = f"laconic-{hash}"
|
||||||
if ctx.verbose:
|
if ctx.verbose:
|
||||||
print(f"Using cluster name: {cluster}")
|
print(f"Using cluster name: {cluster}")
|
||||||
|
1
cli.py
1
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(setup_repositories.command, "setup-repositories")
|
||||||
cli.add_command(build_containers.command, "build-containers")
|
cli.add_command(build_containers.command, "build-containers")
|
||||||
cli.add_command(build_npms.command, "build-npms")
|
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(deploy_system.command, "deploy-system")
|
||||||
cli.add_command(version.command, "version")
|
cli.add_command(version.command, "version")
|
||||||
|
Loading…
Reference in New Issue
Block a user