osa_toolkit/filesystem.py
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:
        # tar.getmembers() is always ordered with the
        # tar standard append file order
        members = [i.name for i in tar.getmembers()]
        if len(members) > 15:
            with open(os.devnull, 'w') as null:
                for member in members[:-15]:
                    subprocess.call(
                        ['tar', '-vf', inventory_backup_file,
                         '--delete', member],
                        stdout=null,
                        stderr=subprocess.STDOUT
                    )

        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))
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:
    
Create a backup of all previous inventory files as a tar archive
Create a backup of all previous inventory files as a tar archive
def _make_backup(backup_path, source_file_path):
    inventory_backup_file = os.path.join(
        backup_path,
        'backup_openstack_inventory.tar'
    )
    with tarfile.open(inventory_backup_file, 'a') as tar:
        members = [i.name for i in tar.getmembers()]
        if len(members) > 15:
            with open(os.devnull, 'w') as null:
                for member in members[:-15]:
                    subprocess.call(
                        ['tar', '-vf', inventory_backup_file,
                         '--delete', member],
                        stdout=null,
                        stderr=subprocess.STDOUT
                    )
        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))
def _make_backup ( backup_path , source_file_path ) : inventory_backup_file = os . path . join ( backup_path , 'backup_openstack_inventory.tar' ) with tarfile . open ( inventory_backup_file , 'a' ) as tar : members = [ i . name for i in tar . getmembers ( ) ] if len ( members ) > 15 : with open ( os . devnull , 'w' ) as null : for member in members [ : - 15 ] : subprocess . call ( [ 'tar' , '-vf' , inventory_backup_file , '--delete' , member ] , stdout = null , stderr = subprocess . STDOUT ) 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 ) )
Create a backup of all previous inventory files as a tar archive
Create a backup of all previous inventory files as a tar archive
"""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:
    """ # tar.getmembers() is always ordered with the # tar standard append file order
None
backup_path
None
source_file_path
path of file to backup
path of file to backup