Merge pull request #23 from sadnub/feature-policies-alerts

Policy Delete Fix
This commit is contained in:
wh1te909 2020-06-13 19:26:08 -07:00 committed by GitHub
commit b440e40507
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -1,4 +1,4 @@
from django.db.models.signals import post_save, post_delete, m2m_changed
from django.db.models.signals import post_save, pre_delete
from django.dispatch import receiver
from automation.models import Policy
@ -32,7 +32,7 @@ def post_save_check_handler(sender, instance, created, **kwargs):
if instance.policy != None:
set_agent_policy_update_field(instance.policy)
@receiver(post_delete, sender="checks.Check")
@receiver(pre_delete, sender="checks.Check")
def post_delete_check_handler(sender, instance, **kwargs):
# don't run when policy managed check is saved
@ -45,7 +45,7 @@ def post_delete_check_handler(sender, instance, **kwargs):
instance.agent.policies_pending=True
instance.agent.save()
@receiver([post_save, post_delete], sender="automation.Policy")
@receiver([post_save, pre_delete], sender="automation.Policy")
def post_save_policy_handler(sender, instance, **kwargs):
set_agent_policy_update_field(instance)