Fix serialization error in view

Also moved policy processing to celery task
This commit is contained in:
sadnub 2021-09-23 11:02:45 -04:00 committed by GitHub
parent 4a702b6813
commit ce56afbdf9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -137,11 +137,11 @@ class GetUpdateDeleteCheck(APIView):
# Re-evaluate agent checks is policy was enforced # Re-evaluate agent checks is policy was enforced
if check.policy.enforced: if check.policy.enforced:
generate_agent_checks_task.delay(policy=check.policy) generate_agent_checks_task.delay(policy=check.policy.pk)
# Agent check deleted # Agent check deleted
elif check.agent: elif check.agent:
check.agent.generate_checks_from_policies() generate_agent_checks_task.delay(agents=[check.agent.pk])
return Response(f"{check.readable_desc} was deleted!") return Response(f"{check.readable_desc} was deleted!")