Bulk update host field to null for JobEvents

This commit is contained in:
Wayne Witzel III 2018-05-03 10:41:48 -04:00
parent 05556809d3
commit 91a2466650

View File

@ -561,6 +561,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',