From 52f04d909e9d710afefefcb317ca972b439c2251 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Behmo?= Date: Tue, 9 Jul 2019 17:57:00 +0800 Subject: [PATCH] Add `dev exec` command for debugging apps in dev mode --- CHANGELOG.md | 1 + tutor/commands/dev.py | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index db2ede6..23960fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ Note: Breaking changes between versions are indicated by "💥". ## Latest +- [Feature] Add `dev exec` command - [Bugfix] Fix incorrect notes settings definition - [Improvement] Make it possible to start/stop/reboot a selection of services - [Improvement] Add ``local/k8s reboot`` commands diff --git a/tutor/commands/dev.py b/tutor/commands/dev.py index 78a21ce..19511cd 100644 --- a/tutor/commands/dev.py +++ b/tutor/commands/dev.py @@ -33,6 +33,19 @@ def run(root, edx_platform_path, edx_platform_settings, service, command, args): root, edx_platform_path, edx_platform_settings, port, *run_command ) +@click.command( + help="Exec a command in a running container", + context_settings={"ignore_unknown_options": True}, +) +@opts.root +@click.argument("service") +@click.argument("command") +@click.argument("args", nargs=-1) +def execute(root, service, command, args): + exec_command = ["exec", service, command] + if args: + exec_command += args + docker_compose(root, *exec_command) @click.command(help="Run a development server") @opts.root @@ -131,6 +144,7 @@ def service_port(service): dev.add_command(run) +dev.add_command(execute, name="exec") dev.add_command(runserver) dev.add_command(stop) dev.add_command(watchthemes)