'Recover a specific checkpoint.
Recover a specific checkpoint provided by cp_dir
Note: this function does not reload augeas.
:param str cp_dir: checkpoint directory file path
:raises errors.ReverterError: If unable to recover checkpoint'

def _recover_checkpoint(self, cp_dir):

    if os.path.isfile(os.path.join(cp_dir, 'COMMANDS')):
        self._run_undo_commands(os.path.join(cp_dir, 'COMMANDS'))
    if os.path.isfile(os.path.join(cp_dir, 'FILEPATHS')):
        try:
            with open(os.path.join(cp_dir, 'FILEPATHS')) as paths_fd:
                filepaths = paths_fd.read().splitlines()
                for (idx, path) in enumerate(filepaths):
                    shutil.copy2(os.path.join(cp_dir, ((os.path.basename(path) + '_') + str(idx))), path)
        except (IOError, OSError):
            logger.error('Unable    to    recover    files    from    %s', cp_dir)
            raise errors.ReverterError(('Unable    to    recover    files    from    %s' % cp_dir))
    self._remove_contained_files(os.path.join(cp_dir, 'NEW_FILES'))
    try:
        shutil.rmtree(cp_dir)
    except OSError:
        logger.error('Unable    to    remove    directory:    %s', cp_dir)
        raise errors.ReverterError(('Unable    to    remove    directory:    %s' % cp_dir))
