6
0
mirror of https://github.com/ChristianLight/tutor.git synced 2024-11-05 04:48:00 +00:00

Add pre-init hook

The 0003 migration from the certificates app of the LMS requires that
the S3-like platform is correctly setup during initialisation. To solve
this issue, we introduce a pre-init hook that is run prior to the LMS
migrations.
This commit is contained in:
Régis Behmo 2019-07-05 14:19:23 +08:00
parent 7c13be4eec
commit 931dac2e68
6 changed files with 18 additions and 2 deletions

View File

@ -2,6 +2,10 @@
Note: Breaking changes between versions are indicated by "💥".
## Latest
- [Bugfix] Add pre-init hook for correct initialisation of minio
## 3.5.2 (2019-07-05)
- [Security] Apply certificate XSS security patch

View File

@ -105,6 +105,12 @@ Example::
During initialisation, "myservice1" and "myservice2" will be run in sequence with the commands defined in the templates ``myplugin/hooks/myservice1/init`` and ``myplugin/hooks/myservice2/init``.
``pre-init``
++++++++++++
This hook will be executed just before the ``init`` hooks. Otherwise, the specs are identical. This is useful for creating databases or other resources that will be required during initialisation, for instance.
``build-image``
+++++++++++++++

View File

@ -10,7 +10,7 @@ with io.open(os.path.join(here, "README.rst"), "rt", encoding="utf8") as f:
setup(
name="tutor-minio",
version="0.0.1",
version="0.0.2",
url="https://docs.tutor.overhang.io/",
project_urls={
"Documentation": "https://docs.tutor.overhang.io/",

View File

@ -22,7 +22,7 @@ config = {
templates = os.path.join(HERE, "templates")
hooks = {
"init": ["minio-client"],
"pre-init": ["minio-client"],
"remote-image": {
"minio-server": "{{ MINIO_DOCKER_IMAGE_SERVER }}",
"minio-client": "{{ MINIO_DOCKER_IMAGE_CLIENT }}",

View File

@ -37,6 +37,12 @@ class BaseRunner:
def initialise(runner):
fmt.echo_info("Initialising all services...")
runner.run("mysql-client", "hooks", "mysql-client", "init")
for plugin_name, hook in runner.iter_plugin_hooks("pre-init"):
for service in hook:
fmt.echo_info(
"Plugin {}: running pre-init for service {}...".format(plugin_name, service)
)
runner.run(service, plugin_name, "hooks", service, "pre-init")
for service in ["lms", "cms", "forum"]:
if runner.is_activated(service):
fmt.echo_info("Initialising {}...".format(service))