From 94052c2b2b1756c4c7e8d4753d45bbf5b1753b94 Mon Sep 17 00:00:00 2001 From: Akita Noek Date: Fri, 22 Jul 2016 16:44:00 -0400 Subject: [PATCH] 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 --- awx/main/migrations/_rbac.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/awx/main/migrations/_rbac.py b/awx/main/migrations/_rbac.py index e263271eab..b60ac65691 100644 --- a/awx/main/migrations/_rbac.py +++ b/awx/main/migrations/_rbac.py @@ -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: