diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d34892..2e39c7d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/docs/plugins.rst b/docs/plugins.rst index 7339381..47c0ad3 100644 --- a/docs/plugins.rst +++ b/docs/plugins.rst @@ -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`` +++++++++++++++ diff --git a/plugins/minio/setup.py b/plugins/minio/setup.py index 2fba2f2..ac3f5ea 100644 --- a/plugins/minio/setup.py +++ b/plugins/minio/setup.py @@ -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/", diff --git a/plugins/minio/tutorminio/plugin.py b/plugins/minio/tutorminio/plugin.py index fcea1dd..dc8aee7 100644 --- a/plugins/minio/tutorminio/plugin.py +++ b/plugins/minio/tutorminio/plugin.py @@ -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 }}", diff --git a/plugins/minio/tutorminio/templates/minio/hooks/minio-client/init b/plugins/minio/tutorminio/templates/minio/hooks/minio-client/pre-init similarity index 100% rename from plugins/minio/tutorminio/templates/minio/hooks/minio-client/init rename to plugins/minio/tutorminio/templates/minio/hooks/minio-client/pre-init diff --git a/tutor/scripts.py b/tutor/scripts.py index a223bef..ccfe84d 100644 --- a/tutor/scripts.py +++ b/tutor/scripts.py @@ -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))