Comment 0 for bug 1750233

I have been seeing the runs randomly break more recently. It seems to happen
more often on larger environments with multiple people/scripts accessing the inventory for various
tasks. It looks like the /etc/openstack_deploy/backup_openstack_inventory.tar archive is getting
corrupted causing the inventory script to bomb on all future calls. The workaround is to blow it
away the tar file and rerun the script to re-generate.

You can simulate by running multiple calls to it at once.

root@shan5464-aio:/opt/openstack-ansible/inventory# cat

rm /etc/openstack_deploy/backup_openstack_inventory.tar
for ITER in {1..40}; do
  /opt/openstack-ansible/inventory/ > /dev/null 2>&1 &

root@shan5464-aio:/opt/openstack-ansible/inventory# ./

root@shan5464-aio:/opt/openstack-ansible/inventory# /opt/openstack-ansible/inventory/
Traceback (most recent call last):
  File "/opt/openstack-ansible/inventory/", line 80, in <module>
    output = generate.main(**all_args)
  File "/opt/openstack-ansible/osa_toolkit/", line 1075, in main
    inventory, inv_path = filesys.load_inventory(config, INVENTORY_SKEL)
  File "/opt/openstack-ansible/osa_toolkit/", line 247, in load_inventory
    _make_backup(load_path, file_loaded)
  File "/opt/openstack-ansible/osa_toolkit/", line 156, in _make_backup
    with, 'a') as tar:
  File "/usr/lib/python2.7/", line 1711, in open
    return cls.taropen(name, mode, fileobj, **kwargs)
  File "/usr/lib/python2.7/", line 1721, in taropen
    return cls(name, mode, fileobj, **kwargs)
  File "/usr/lib/python2.7/", line 1601, in __init__
    raise ReadError(str(e))
tarfile.ReadError: empty header

root@shan5464-aio:/opt/openstack-ansible/inventory# rm /etc/openstack_deploy/backup_openstack_inventory.tar

root@shan5464-aio:/opt/openstack-ansible/inventory# /opt/openstack-ansible/inventory/ | head -n 4
    "_meta": {
        "hostvars": {
            "shan5464-aio": {

Looks like it may need to handle locking in osa_toolkit/ or a way to run it read-only to keep the inventory/backup files from being generated on every call.