mirror of
https://github.com/ansible/awx.git
synced 2026-04-05 01:59:25 -02:30
Make use of callback explicitly for Project and Inventory
This commit is contained in:
@@ -250,16 +250,14 @@ def save_related_job_templates(sender, instance, **kwargs):
|
|||||||
Organization updated. This triggers the rebuilding of the RBAC hierarchy
|
Organization updated. This triggers the rebuilding of the RBAC hierarchy
|
||||||
and ensures the proper access restrictions.
|
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:
|
if instance.__original_org != instance.organization:
|
||||||
instance.__original_org = instance.organization
|
instance.__original_org = instance.organization
|
||||||
jtq = None
|
jtq = JobTemplate.objects.filter(**{sender.__name__.lower(): instance})
|
||||||
if sender == Project:
|
for jt in jtq.all():
|
||||||
jtq = JobTemplate.objects.filter(project=instance)
|
jt.save()
|
||||||
elif sender == Inventory:
|
|
||||||
jtq = JobTemplate.objects.filter(inventory=instance)
|
|
||||||
if jtq:
|
|
||||||
for jt in jtq.all():
|
|
||||||
jt.save()
|
|
||||||
|
|
||||||
|
|
||||||
def connect_computed_field_signals():
|
def connect_computed_field_signals():
|
||||||
|
|||||||
Reference in New Issue
Block a user