Comment 3 for bug 1750233

Looks like it was pulled out of the main dplaybooks/inventory/dynamic_inventory.py script somewhere between newton and master and placed into osa_toolkit/filesystem.py. The overall code for most of it looks the same. Below is a snippet of the backup portion.

# grep 'def make_backup' ./openstack-ansible/playbooks/inventory/dynamic_inventory.py -A 11
def make_backup(config_path, inventory_file_path):
    # Create a backup of all previous inventory files as a tar archive
    inventory_backup_file = os.path.join(
        config_path,
        'backup_openstack_inventory.tar'
    )
    with tarfile.open(inventory_backup_file, 'a') as tar:
        basename = os.path.basename(inventory_file_path)
        backup_name = get_backup_name(basename)
        tar.add(inventory_file_path, arcname=backup_name)
    logger.debug("Backup written to %s", inventory_backup_file)

# grep 'def _make_backup' /opt/openstack-ansible/osa_toolkit/filesystem.py -A17
def _make_backup(backup_path, source_file_path):
    """Create a backup of all previous inventory files as a tar archive

    :param backup_path: where to store the backup file
    :param source_file_path: path of file to backup
    :return:
    """

    inventory_backup_file = os.path.join(
        backup_path,
        'backup_openstack_inventory.tar'
    )
    with tarfile.open(inventory_backup_file, 'a') as tar:
        basename = os.path.basename(source_file_path)
        backup_name = _get_backup_name(basename)
        tar.add(source_file_path, arcname=backup_name)
    logger.debug("Backup written to {}".format(inventory_backup_file))