def cmd_config(argv, args): """ Usage: localstack config <subcommand> [options] Commands: config validate Validate local configurations (e.g. docker-compose) Options: --file=<> Use custom docker compose file (default: docker-compose.yml) """ args.update(docopt(cmd_config.__doc__.strip(), argv=argv)) if args["<subcommand>"] == "validate": docker_compose_file_name = args.get("--file") or "docker-compose.yml" validate_localstack_config(docker_compose_file_name) else: raise Exception("Please specify a valid command")
def cmd_config_validate(file): from rich.panel import Panel from localstack.utils import bootstrap try: if bootstrap.validate_localstack_config(file): console.print("[green]:heavy_check_mark:[/green] config valid") sys.exit(0) else: console.print( "[red]:heavy_multiplication_x:[/red] validation error") sys.exit(1) except Exception as e: console.print(Panel(str(e), title="[red]Error[/red]", expand=False)) console.print("[red]:heavy_multiplication_x:[/red] validation error") sys.exit(1)