Merge pull request #1675 from wwitzel3/fix-879

Bulk update host field to null for JobEvents
This commit is contained in:
Wayne Witzel III
2018-05-03 11:15:15 -04:00
committed by GitHub

View File

@@ -548,6 +548,8 @@ def delete_inventory(self, inventory_id, user_id):
with ignore_inventory_computed_fields(), ignore_inventory_group_removal(), impersonate(user):
try:
i = Inventory.objects.get(id=inventory_id)
for host in i.hosts.iterator():
host.job_events_as_primary_host.update(host=None)
i.delete()
emit_channel_notification(
'inventories-status_changed',