1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 08:21:15 +03:00

Fixed credential migration issue involving null inventory fields in job templates

Don't attempt to derive credential organization information from a job
template when the inventory field is null for that job template

 #3107
This commit is contained in:
Akita Noek 2016-07-22 16:44:00 -04:00
parent 4b3f1d44de
commit 94052c2b2b

View File

@ -159,7 +159,7 @@ def migrate_credential(apps, schema_editor):
InventorySource = apps.get_model('main', 'InventorySource')
for cred in Credential.objects.iterator():
results = [x for x in JobTemplate.objects.filter(Q(credential=cred) | Q(cloud_credential=cred)).all()] + \
results = [x for x in JobTemplate.objects.filter(Q(credential=cred) | Q(cloud_credential=cred), inventory__isnull=False).all()] + \
[x for x in InventorySource.objects.filter(credential=cred).all()]
if cred.deprecated_team is not None and results:
if len(results) == 1: