mirror of
https://github.com/ChristianLight/tutor.git
synced 2024-12-04 19:03:39 +00:00
depr: remove obsolete task actions
This commit is contained in:
parent
3ab0dcb9e6
commit
a5dd3017d7
@ -9,3 +9,4 @@
|
||||
- The `PLUGIN_LOADED` ActionTemplate is now an Action which takes a single argument. (the plugin name)
|
||||
- 💥[Refactor] We refactored the hooks API further by removing the static hook indexes and the hooks names. As a consequence:
|
||||
- The syntactic sugar functions from the "filters" and "actions" modules were all removed: `get`, `add*`, `iterate*`, `apply*`, `do*`, etc.
|
||||
- 💥[Deprecation] The obsolete filters `COMMANDS_PRE_INIT` and `COMMANDS_INIT` have been removed. Plugin developers should instead use `CLI_DO_INIT_TASKS` (with suitable priorities).
|
||||
|
@ -66,31 +66,12 @@ def initialise(limit: t.Optional[str]) -> t.Iterator[tuple[str, str]]:
|
||||
fmt.echo_info("Initialising all services...")
|
||||
filter_context = hooks.Contexts.app(limit).name if limit else None
|
||||
|
||||
# Deprecated pre-init tasks
|
||||
for service, path in hooks.Filters.COMMANDS_PRE_INIT.iterate_from_context(
|
||||
filter_context
|
||||
):
|
||||
fmt.echo_alert(
|
||||
f"Running deprecated pre-init task: {'/'.join(path)}. Init tasks should no longer be added to the COMMANDS_PRE_INIT filter. Plugin developers should use the CLI_DO_INIT_TASKS filter instead, with a high priority."
|
||||
)
|
||||
yield service, env.read_template_file(*path)
|
||||
|
||||
# Init tasks
|
||||
for service, task in hooks.Filters.CLI_DO_INIT_TASKS.iterate_from_context(
|
||||
filter_context
|
||||
):
|
||||
fmt.echo_info(f"Running init task in {service}")
|
||||
yield service, task
|
||||
|
||||
# Deprecated init tasks
|
||||
for service, path in hooks.Filters.COMMANDS_INIT.iterate_from_context(
|
||||
filter_context
|
||||
):
|
||||
fmt.echo_alert(
|
||||
f"Running deprecated init task: {'/'.join(path)}. Init tasks should no longer be added to the COMMANDS_INIT filter. Plugin developers should use the CLI_DO_INIT_TASKS filter instead."
|
||||
)
|
||||
yield service, env.read_template_file(*path)
|
||||
|
||||
fmt.echo_info("All services initialised.")
|
||||
|
||||
|
||||
|
@ -188,28 +188,6 @@ class Filters:
|
||||
#: may contain Jinja markup, similar to templates.
|
||||
CLI_DO_INIT_TASKS: Filter[list[tuple[str, str]], []] = Filter()
|
||||
|
||||
#: DEPRECATED use :py:data:`CLI_DO_INIT_TASKS` instead.
|
||||
#:
|
||||
#: List of commands to be executed during initialization. These commands typically
|
||||
#: include database migrations, setting feature flags, etc.
|
||||
#:
|
||||
#: :parameter list[tuple[str, tuple[str, ...]]] tasks: list of ``(service, path)`` tasks.
|
||||
#:
|
||||
#: - ``service`` is the name of the container in which the task will be executed.
|
||||
#: - ``path`` is a tuple that corresponds to a template relative path.
|
||||
#: Example: ``("myplugin", "hooks", "myservice", "pre-init")`` (see :py:data:`IMAGES_BUILD`).
|
||||
#: The command to execute will be read from that template, after it is rendered.
|
||||
COMMANDS_INIT: Filter[list[tuple[str, tuple[str, ...]]], []] = Filter()
|
||||
|
||||
#: DEPRECATED use :py:data:`CLI_DO_INIT_TASKS` instead with a lower priority score.
|
||||
#:
|
||||
#: List of commands to be executed prior to initialization. These commands are run even
|
||||
#: before the mysql databases are created and the migrations are applied.
|
||||
#:
|
||||
#: :parameter list[tuple[str, tuple[str, ...]]] tasks: list of ``(service, path)``
|
||||
#: tasks. (see :py:data:`COMMANDS_INIT`).
|
||||
COMMANDS_PRE_INIT: Filter[list[tuple[str, tuple[str, ...]]], []] = Filter()
|
||||
|
||||
#: List of folders to bind-mount in docker-compose containers, either in ``tutor local`` or ``tutor dev``.
|
||||
#:
|
||||
#: This filter is for processing values of the ``MOUNTS`` setting such as::
|
||||
|
Loading…
Reference in New Issue
Block a user