fix agent not getting alert template when policies change
This commit is contained in:
parent
6b4704b2e2
commit
4c1d2ab1bb
|
@ -45,6 +45,8 @@ class Policy(BaseAuditModel):
|
|||
if old_policy:
|
||||
if old_policy.alert_template != self.alert_template:
|
||||
cache_agents_alert_template.delay()
|
||||
elif old_policy.active != self.active and self.alert_template:
|
||||
cache_agents_alert_template.delay()
|
||||
|
||||
def __str__(self) -> str:
|
||||
return self.name
|
||||
|
|
|
@ -56,7 +56,11 @@ class Client(BaseAuditModel):
|
|||
|
||||
# check if polcies have changed and initiate task to reapply policies if so
|
||||
if old_client:
|
||||
if old_client.alert_template != self.alert_template:
|
||||
if (
|
||||
old_client.alert_template != self.alert_template
|
||||
or old_client.workstation_policy != self.workstation_policy
|
||||
or old_client.server_policy != self.server_policy
|
||||
):
|
||||
cache_agents_alert_template.delay()
|
||||
|
||||
class Meta:
|
||||
|
@ -129,7 +133,11 @@ class Site(BaseAuditModel):
|
|||
|
||||
# check if polcies have changed and initiate task to reapply policies if so
|
||||
if old_site:
|
||||
if old_site.alert_template != self.alert_template:
|
||||
if (
|
||||
old_site.alert_template != self.alert_template
|
||||
or old_site.workstation_policy != self.workstation_policy
|
||||
or old_site.server_policy != self.server_policy
|
||||
):
|
||||
cache_agents_alert_template.delay()
|
||||
|
||||
class Meta:
|
||||
|
|
|
@ -107,8 +107,12 @@ class CoreSettings(BaseAuditModel):
|
|||
old_settings = type(self).objects.get(pk=self.pk) if self.pk else None
|
||||
super(BaseAuditModel, self).save(*args, **kwargs)
|
||||
|
||||
if old_settings and old_settings.alert_template != self.alert_template:
|
||||
cache_agents_alert_template.delay()
|
||||
if old_settings:
|
||||
if (
|
||||
old_settings.alert_template != self.alert_template
|
||||
or old_settings.policy != self.policy
|
||||
):
|
||||
cache_agents_alert_template.delay()
|
||||
|
||||
def __str__(self) -> str:
|
||||
return "Global Site Settings"
|
||||
|
|
Loading…
Reference in New Issue