From 91a24666501c437aa37c4448709931932892ad67 Mon Sep 17 00:00:00 2001 From: Wayne Witzel III Date: Thu, 3 May 2018 10:41:48 -0400 Subject: [PATCH] Bulk update host field to null for JobEvents --- awx/main/tasks.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/awx/main/tasks.py b/awx/main/tasks.py index 31edcc38d7..d9236b5643 100644 --- a/awx/main/tasks.py +++ b/awx/main/tasks.py @@ -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',