1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-02 09:51:09 +03:00

Make use of callback explicitly for Project and Inventory

This commit is contained in:
Wayne Witzel III 2018-04-05 11:05:48 -04:00
parent 3411389d00
commit 0bd9919108

View File

@ -250,16 +250,14 @@ def save_related_job_templates(sender, instance, **kwargs):
Organization updated. This triggers the rebuilding of the RBAC hierarchy
and ensures the proper access restrictions.
'''
if sender not in (Project, Inventory):
raise ValueError('This signal callback is only intended for use with Project or Inventory')
if instance.__original_org != instance.organization:
instance.__original_org = instance.organization
jtq = None
if sender == Project:
jtq = JobTemplate.objects.filter(project=instance)
elif sender == Inventory:
jtq = JobTemplate.objects.filter(inventory=instance)
if jtq:
for jt in jtq.all():
jt.save()
jtq = JobTemplate.objects.filter(**{sender.__name__.lower(): instance})
for jt in jtq.all():
jt.save()
def connect_computed_field_signals():