Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
This commit is contained in:
Marc 'risson' Schmitt
2025-06-04 16:51:59 +02:00
parent 4b8b80f1d4
commit 369437f2a1
4 changed files with 11 additions and 14 deletions

View File

@ -129,5 +129,5 @@ class BlueprintInstanceViewSet(UsedByMixin, ModelViewSet):
def apply(self, request: Request, *args, **kwargs) -> Response:
"""Apply a blueprint"""
blueprint = self.get_object()
apply_blueprint.send(blueprint.pk).get()
apply_blueprint.send_with_options(args=(blueprint.pk,), rel_obj=blueprint)
return self.retrieve(request, *args, **kwargs)

View File

@ -44,7 +44,7 @@ class ApplyBlueprintMetaSerializer(PassiveSerializer):
return MetaResult()
LOGGER.debug("Applying blueprint from meta model", blueprint=self.blueprint_instance)
apply_blueprint(str(self.blueprint_instance.pk))
apply_blueprint(self.blueprint_instance.pk)
return MetaResult()

View File

@ -4,6 +4,7 @@ from dataclasses import asdict, dataclass, field
from hashlib import sha512
from pathlib import Path
from sys import platform
from uuid import UUID
from dacite.core import from_dict
from django.db import DatabaseError, InternalError, ProgrammingError
@ -192,7 +193,7 @@ def check_blueprint_v1_file(blueprint: BlueprintFile):
@actor
def apply_blueprint(instance_pk: str):
def apply_blueprint(instance_pk: UUID):
"""Apply single blueprint"""
self = CurrentTask.get_task()
self.set_uid(str(instance_pk))

View File

@ -63,29 +63,25 @@ class AuthentikOutpostConfig(ManagedAppConfig):
else:
Outpost.objects.filter(managed=MANAGED_OUTPOST).delete()
@ManagedAppConfig.reconcile_global
def outpost_connection_discovery(self):
from authentik.tasks.schedules.models import Schedule
for schedule in Schedule.objects.filter(
actor_name__in=("authentik.outposts.tasks.outpost_connection_discovery",),
):
schedule.send()
@property
def tenant_schedule_specs(self) -> list[ScheduleSpec]:
from authentik.outposts.tasks import outpost_token_ensurer
return [
ScheduleSpec(
actor_name="authentik.outposts.tasks.outpost_token_ensurer",
actor_name=outpost_token_ensurer.actor_name,
crontab=f"{fqdn_rand('outpost_token_ensurer')} */8 * * *",
),
]
@property
def global_schedule_specs(self) -> list[ScheduleSpec]:
from authentik.outposts.tasks import outpost_connection_discovery
return [
ScheduleSpec(
actor_name="authentik.outposts.tasks.outpost_connection_discovery",
actor_name=outpost_connection_discovery.actor_name,
crontab=f"{fqdn_rand('outpost_connection_discovery')} */8 * * *",
run_on_startup=True,
),
]