remove bootstrap tasks
Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
This commit is contained in:
@ -1,21 +0,0 @@
|
|||||||
"""Run bootstrap tasks"""
|
|
||||||
|
|
||||||
from django.core.management.base import BaseCommand
|
|
||||||
from django_tenants.utils import get_public_schema_name
|
|
||||||
|
|
||||||
from authentik.root.celery import _get_startup_tasks_all_tenants, _get_startup_tasks_default_tenant
|
|
||||||
from authentik.tenants.models import Tenant
|
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
|
||||||
"""Run bootstrap tasks to ensure certain objects are created"""
|
|
||||||
|
|
||||||
def handle(self, **options):
|
|
||||||
for task in _get_startup_tasks_default_tenant():
|
|
||||||
with Tenant.objects.get(schema_name=get_public_schema_name()):
|
|
||||||
task()
|
|
||||||
|
|
||||||
for task in _get_startup_tasks_all_tenants():
|
|
||||||
for tenant in Tenant.objects.filter(ready=True):
|
|
||||||
with tenant:
|
|
||||||
task()
|
|
@ -74,12 +74,6 @@ fi
|
|||||||
|
|
||||||
if [[ "$1" == "server" ]]; then
|
if [[ "$1" == "server" ]]; then
|
||||||
set_mode "server"
|
set_mode "server"
|
||||||
# If we have bootstrap credentials set, run bootstrap tasks outside of main server
|
|
||||||
# sync, so that we can sure the first start actually has working bootstrap
|
|
||||||
# credentials
|
|
||||||
if [[ ! -z "${AUTHENTIK_BOOTSTRAP_PASSWORD}" || ! -z "${AUTHENTIK_BOOTSTRAP_TOKEN}" ]]; then
|
|
||||||
python -m manage bootstrap_tasks
|
|
||||||
fi
|
|
||||||
run_authentik
|
run_authentik
|
||||||
elif [[ "$1" == "worker" ]]; then
|
elif [[ "$1" == "worker" ]]; then
|
||||||
set_mode "worker"
|
set_mode "worker"
|
||||||
|
@ -35,9 +35,7 @@ if __name__ == "__main__":
|
|||||||
if (
|
if (
|
||||||
len(sys.argv) > 1
|
len(sys.argv) > 1
|
||||||
# Explicitly only run migrate for server and worker
|
# Explicitly only run migrate for server and worker
|
||||||
# `bootstrap_tasks` is a special case as that command might be triggered by the `ak`
|
and sys.argv[1] in ["dev_server", "worker"]
|
||||||
# script to pre-run certain tasks for an automated install
|
|
||||||
and sys.argv[1] in ["dev_server", "worker", "bootstrap_tasks"]
|
|
||||||
# and don't run if this is the child process of a dev_server
|
# and don't run if this is the child process of a dev_server
|
||||||
and os.environ.get(DJANGO_AUTORELOAD_ENV, None) is None
|
and os.environ.get(DJANGO_AUTORELOAD_ENV, None) is None
|
||||||
):
|
):
|
||||||
|
Reference in New Issue
Block a user