mirror of
https://github.com/ansible/awx.git
synced 2026-03-13 15:09:32 -02:30
Check for null attributes related to an inventory update when performing
the name migration
This commit is contained in:
@@ -9,6 +9,8 @@ class Migration(DataMigration):
|
|||||||
|
|
||||||
def forwards(self, orm):
|
def forwards(self, orm):
|
||||||
for iu in orm.InventoryUpdate.objects.filter(active=True):
|
for iu in orm.InventoryUpdate.objects.filter(active=True):
|
||||||
|
if iu.inventory_source is None or iu.inventory_source.group is None or iu.inventory_source.inventory is None:
|
||||||
|
continue
|
||||||
iu.name = "%s (%s)" % (iu.inventory_source.group.name, iu.inventory_source.inventory.name)
|
iu.name = "%s (%s)" % (iu.inventory_source.group.name, iu.inventory_source.inventory.name)
|
||||||
iu.save()
|
iu.save()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user