def install_provision_config(src, dstpath, backup_ext='_aminator'):
    if os.path.isfile(src) or os.path.isdir(src):
        log.debug('Copying {0} from the aminator host to {1}'.format(src, dstpath))
        dst = os.path.join(dstpath.rstrip('/'), src.lstrip('/'))
        log.debug('copying src: {0} dst: {1}'.format(src, dst))
        try:
            if os.path.isfile(dst) or os.path.islink(dst) or os.path.isdir(dst):
                backup = '{0}{1}'.format(dst, backup_ext)
                log.debug('Making backup of {0}'.format(dst))
                try:
                    if os.path.isdir(dst) or os.path.islink(dst):
                        try:
                            os.rename(dst, backup)
                        except __HOLE__ as e:
                            if e.errno == 18:  # EXDEV Invalid cross-device link
                                # need to copy across devices
                                if os.path.isdir(dst):
                                    shutil.copytree(dst, backup, symlinks=True)
                                    shutil.rmtree(dst)
                                elif os.path.islink(dst):
                                    link = os.readlink(dst)
                                    os.remove(dst)
                                    os.symlink(link, backup)

                    elif os.path.isfile(dst):
                        shutil.copy(dst, backup)
                except Exception:
                    errstr = 'Error encountered while copying {0} to {1}'.format(dst, backup)
                    log.critical(errstr)
                    log.debug(errstr, exc_info=True)
                    return False
            if os.path.isdir(src):
                shutil.copytree(src, dst, symlinks=True)
            else:
                shutil.copy(src, dst)
        except Exception:
            errstr = 'Error encountered while copying {0} to {1}'.format(src, dst)
            log.critical(errstr)
            log.debug(errstr, exc_info=True)
            return False
        log.debug('{0} copied from aminator host to {1}'.format(src, dstpath))
        return True
    else:
        log.critical('File not found: {0}'.format(src))
        return True
dataset/ETHPy150Open Netflix/aminator/aminator/util/linux.py/install_provision_config