I delete all the Demo configured items via towercli:
tower-cli project delete -n "Demo Project"
tower-cli inventory delete -n "Demo Inventory"
tower-cli credential delete -n "Demo Credential"
tower-cli job_template delete -n "Demo Job Template"
but with the deletion of the Demo Inventory something went wrong. It still remains "pending deletion". Surviving server reboots.
Deleting the only existing Host "localhost" in this inventory is denied by the message:
error : The inventory for this host is already being deleted."
Happened once out of 3 environments - but I would like to know how to handle that
Inventory gets deleted
Inventory remained in the Setup - pending deletion
http://towerhost/api/v2/unified_jobs/?status=running
returns 0 on count
But I am able to find the stuck job when running:
awx-manage shell_plus
....
Inventory.objects.filter(pending_deletion=True)
<QuerySet [<Inventory: Demo Inventory-1>]>
I welcome any ideas :)
@mwiora if I had to guess, something probably interrupted the deletion, and it got stuck in this pending state.
Try running this in the shell_plus?
Inventory.objects.filter(pending_deletion=True).update(pending_deletion=False)
Ran into the same issue while nuking the test environment, running Inventory.objects.filter(pending_deletion=True).update(pending_deletion=False) worked
The inventory had a source script running every 60s, the inventory script (not the source) was deleted right before i tried to delete the inventory
@ryanpetrello NICE! worked like a charm and I could delete the inventory afterwards without any issues.
In my case I assume, that I've been rebooting the AWX tower host during the pending deletion job as my scripts are doing it automatically. Maybe there would be an option to "cleanup" all stucked jobs which are in pending state on a machine startup.
Thanks!
Most helpful comment
@mwiora if I had to guess, something probably interrupted the deletion, and it got stuck in this pending state.
Try running this in the
shell_plus?