6
0
mirror of https://github.com/ChristianLight/tutor.git synced 2024-12-12 06:07:56 +00:00

Introduce local hook command

This commit is contained in:
Régis Behmo 2019-10-04 11:43:26 +02:00
parent 53f1813409
commit 762e7984c2
2 changed files with 24 additions and 0 deletions

View File

@ -4,6 +4,7 @@ Note: Breaking changes between versions are indicated by "💥".
## Unreleased
- [Feature] Introduce `local hook` command for plugin development.
- [Bugfix] Persist `private.txt` file between two runs of `config save`. (#247)
- [Improvement] Added configuration values to limit the number of gunicorn workers for the LMS and CMS.

View File

@ -169,6 +169,28 @@ def init(root):
scripts.initialise(runner)
@click.command(
short_help="Manually trigger hook (advanced users only)",
help="""
Manually trigger a hook for a given plugin/service. This is a low-level command
that is convenient when developing new plugins. Ex:
tutor local hook mysql hooks mysql init
tutor local hook discovery discovery hooks discovery init""",
name="hook",
)
@opts.root
@click.argument("service")
@click.argument("path", nargs=-1)
def run_hook(root, service, path):
config = tutor_config.load(root)
runner = ScriptRunner(root, config)
fmt.echo_info(
"Running '{}' hook in '{}' container...".format(".".join(path), service)
)
runner.run(service, *path)
@click.group(help="Manage https certificates")
def https():
pass
@ -354,6 +376,7 @@ local.add_command(reboot)
local.add_command(run)
local.add_command(execute, name="exec")
local.add_command(init)
local.add_command(run_hook)
local.add_command(https)
local.add_command(logs)
local.add_command(createuser)