コード例 #1
0
    def undo(self):
        if self._dryrun:
            return True

        if not self._executed:
            return False

        Log.cout(Log.INFO, 'Undo install pkg %s ...' % self._pkg)
        if self._success:
            if not file_util.remove(self._ainstPkgDir):
                Log.cout(Log.ERROR, 'Remove pkg %s packages dir failed' % self._pkg)
                return False
            if self._rootInitTrace:
                self._ainstRoot.clearInit(self._rootInitTrace)
            self._init()
            return True

        if self._ainstTmpPkgDir:
            if not file_util.remove(self._ainstTmpPkgDir):
                Log.cout(Log.ERROR, 'Remove pkg %s tmp dir failed' % self._pkg)
                return False
        
        if self._rootInitTrace:
            self._ainstRoot.clearInit(self._rootInitTrace)

        self._init()
        return True
コード例 #2
0
    def undo(self):
        if self._dryrun:
            return True

        if not self._executed:
            return False

        Log.cout(Log.INFO, 'Undo install pkg %s ...' % self._pkg)
        if self._success:
            if not file_util.remove(self._ainstPkgDir):
                Log.cout(Log.ERROR,
                         'Remove pkg %s packages dir failed' % self._pkg)
                return False
            if self._rootInitTrace:
                self._ainstRoot.clearInit(self._rootInitTrace)
            self._init()
            return True

        if self._ainstTmpPkgDir:
            if not file_util.remove(self._ainstTmpPkgDir):
                Log.cout(Log.ERROR, 'Remove pkg %s tmp dir failed' % self._pkg)
                return False

        if self._rootInitTrace:
            self._ainstRoot.clearInit(self._rootInitTrace)

        self._init()
        return True
コード例 #3
0
ファイル: cache_handler.py プロジェクト: luckylecher/cpp
    def _getMetaFile(self, repoMdObj, metaName, fileName):
        if not repoMdObj.repoMdDatas.has_key(metaName):
            return False
        metaObj = repoMdObj.repoMdDatas[metaName]
        destTmpFile = self._getRepoDataDir() + '/' + \
            metaObj.locationHref.split('/')[-1]
        metaUrl = self.repoConfig.baseurl + '/' + metaObj.locationHref
#        uncompressTmpFile = '.'.join(destTmpFile.split('.')[:-1]) + '.tmp'
        uncompressTmpFile = self._getRepoDataDir() + '/' + \
            fileName + '.tmp'
        if not file_util.remove(destTmpFile) or\
                not file_util.remove(uncompressTmpFile):
            return False
        if not self.fileFetcher.fetch(metaUrl, destTmpFile) or\
                not file_util.chmod(destTmpFile, 0666):
            return False
        try:
            if destTmpFile.split('.')[-1] == 'bz2':
                f = bz2.BZ2File(destTmpFile)
            else:
                f = gzip.open(destTmpFile)
            if not file_util.writeToFile(uncompressTmpFile, f.read()) or\
                    not file_util.chmod(uncompressTmpFile, 0666):
                f.close()
                return False
            f.close()
        except Exception:
            Log.cout(Log.ERROR, 'decompress %s failed' % destTmpFile)
            return False
        return self._checkSumValid(metaObj, uncompressTmpFile)
コード例 #4
0
    def undo(self):
        if not self._executed:
            return False

        if self._stateFileName:
            file_util.remove(self._stateFileName)

        if self._tmpFile:
            file_util.remove(self._tmpFile)

        self._executed = False
        return True
コード例 #5
0
ファイル: root_save_executor.py プロジェクト: luckylecher/cpp
    def undo(self):
        if not self._executed:
            return False

        if self._stateFileName:
            file_util.remove(self._stateFileName)

        if self._tmpFile:
            file_util.remove(self._tmpFile)

        self._executed = False
        return True
コード例 #6
0
def _maybe_checkpoint(batch_number, agent, config):
    """Checkpoints the model into the specified directory."""
    if batch_number % config.checkpoint_every:
        return None

    tmp_model_file_path = os.path.join(tempfile.gettempdir(), 'tmp_model.h5')
    agent.model.save(tmp_model_file_path)
    model_file_path = os.path.join(
        config.results_dir,
        f'agent_model_{config.experiment_name}_{batch_number}.h5')
    file_util.copy(tmp_model_file_path, model_file_path, overwrite=True)
    logging.info('Model saved at %s', model_file_path)
    file_util.remove(tmp_model_file_path)
    return model_file_path
コード例 #7
0
ファイル: cache_handler.py プロジェクト: luckylecher/cpp
 def getPackage(self, pkg):
     if self._getRepoDataDir() is None:
         return None
     pkgCacheDir = self._getRepoDataDir() + self.packageCacheDir
     preUmask = os.umask(0)
     if not file_util.makeDir(pkgCacheDir):
         os.umask(preUmask)
         Log.cout(Log.ERROR, 'Make cache dir [%s] failed' % pkgCacheDir)
         return None
     os.umask(preUmask)
     uri = pkg.getLocation()
     if not uri.lower().startswith('http'):
         return None
     pkgFilePath = pkgCacheDir + os.path.basename(uri)
     if file_util.exists(pkgFilePath):
         ctime = os.stat(pkgFilePath).st_ctime
         nowtime = time.time()
         if nowtime - ctime < self.expireTime:
             Log.cout(Log.DEBUG, "Get package [%s] from cache" % pkg)
             return pkgFilePath
         if not file_util.remove(pkgFilePath):
             Log.cout(Log.DEBUG, "Remove old package [%s] because of expired" % pkg)
             return None
             
     if not self.fileFetcher.fetch(uri, pkgFilePath) or \
             not file_util.chmod(pkgFilePath, 0666):
         return None
     return pkgFilePath
コード例 #8
0
 def _getMetaFile(self, repoMdObj, metaName, fileName):
     if not repoMdObj.repoMdDatas.has_key(metaName):
         return False
     metaObj = repoMdObj.repoMdDatas[metaName]
     destTmpFile = self._getRepoDataDir() + '/' + \
         metaObj.locationHref.split('/')[-1]
     metaUrl = self.repoConfig.baseurl + '/' + metaObj.locationHref
     #        uncompressTmpFile = '.'.join(destTmpFile.split('.')[:-1]) + '.tmp'
     uncompressTmpFile = self._getRepoDataDir() + '/' + \
         fileName + '.tmp'
     if not file_util.remove(destTmpFile) or\
             not file_util.remove(uncompressTmpFile):
         return False
     if not self.fileFetcher.fetch(metaUrl, destTmpFile) or\
             not file_util.chmod(destTmpFile, 0666):
         return False
コード例 #9
0
 def _onMakeCacheSuccess(self, cacheType):
     cachecookie = self._getRepoDataDir() + '/' + 'cachecookie'
     if not file_util.remove(cachecookie) or\
             not file_util.writeToFile(cachecookie, '') or\
             not file_util.chmod(cachecookie, 0666):
         Log.cout(Log.ERROR, 'Re-touch cachecookie failed')
         return False
コード例 #10
0
 def _symLinkToActive(self, relativePkgPath, ainstActivePkg):
     lastActivePkg = file_util.readLink(ainstActivePkg)
     if not file_util.remove(ainstActivePkg):
         return False, None
     if not file_util.symLink(relativePkgPath, ainstActivePkg):
         return False, lastActivePkg
     return True, lastActivePkg
コード例 #11
0
    def getPackage(self, pkg):
        if self._getRepoDataDir() is None:
            return None
        pkgCacheDir = self._getRepoDataDir() + self.packageCacheDir
        preUmask = os.umask(0)
        if not file_util.makeDir(pkgCacheDir):
            os.umask(preUmask)
            Log.cout(Log.ERROR, 'Make cache dir [%s] failed' % pkgCacheDir)
            return None
        os.umask(preUmask)
        uri = pkg.getLocation()
        if not uri.lower().startswith('http'):
            return None
        pkgFilePath = pkgCacheDir + os.path.basename(uri)
        if file_util.exists(pkgFilePath):
            ctime = os.stat(pkgFilePath).st_ctime
            nowtime = time.time()
            if nowtime - ctime < self.expireTime:
                Log.cout(Log.DEBUG, "Get package [%s] from cache" % pkg)
                return pkgFilePath
            if not file_util.remove(pkgFilePath):
                Log.cout(Log.DEBUG,
                         "Remove old package [%s] because of expired" % pkg)
                return None

        if not self.fileFetcher.fetch(uri, pkgFilePath) or \
                not file_util.chmod(pkgFilePath, 0666):
            return None
コード例 #12
0
 def _doMakeCache(self, metatype):
     #download repomd.xml to repomd.xml.tmp
     repomdTmpFile = self._getRepoDataDir() + '/' + \
         self.repomdLocation.split('/')[-1] + ".tmp"
     repomdUrl = self.repoConfig.baseurl + self.repomdLocation
     if not file_util.remove(repomdTmpFile) or \
             not self.fileFetcher.fetch(repomdUrl, repomdTmpFile) or\
             not file_util.chmod(repomdTmpFile, 0666):
         return False
コード例 #13
0
 def _removeSettings(self):
     if not file_util.isFile(self._settingPath):
         return True
     tmpPath = self._ainstRoot.getRootVarAinstDir('tmp') +\
         self._pkg.name + self._settingTmpSuffix
     if not file_util.remove(tmpPath) or\
             not file_util.move(self._settingPath, tmpPath):
         return False
     self._tmpSettingPath = tmpPath
     return True
コード例 #14
0
    def _removePkgDir(self, pkgDirName):
        if not file_util.isDir(self._ainstPkgDir):
            return True

        tmpPkgPath = self._ainstRoot.getRootVarAinstDir('tmp') +\
            pkgDirName + self._pkgTmpSuffix
        if not file_util.remove(tmpPkgPath) or\
                not file_util.move(self._ainstPkgDir, tmpPkgPath):
            return False
        self._tmpPkgPath = tmpPkgPath
        return True
コード例 #15
0
ファイル: cache_handler.py プロジェクト: luckylecher/cpp
 def _onMakeCacheSuccess(self, cacheType):
     cachecookie = self._getRepoDataDir() + '/' + 'cachecookie';
     if not file_util.remove(cachecookie) or\
             not file_util.writeToFile(cachecookie, '') or\
             not file_util.chmod(cachecookie, 0666):
         Log.cout(Log.ERROR, 'Re-touch cachecookie failed')
         return False
     repomdTmpFile = self._getRepoDataDir() + '/' + \
         self.repomdLocation.split('/')[-1];
     if not file_util.rename(repomdTmpFile + '.tmp', repomdTmpFile):
         return False
     return self._processTmpFile(cacheType, True)
コード例 #16
0
 def _processTmpFile(self, cacheType, success):
     nameList = []
     if cacheType == PRIMARY_TYPE:
         nameList.append(PRIMARY_FILE)
     elif cacheType == PRIMARYDB_TYPE:
         nameList.append(PRIMARYDB_FILE)
     elif cacheType == ALL_TYPE:
         nameList.append(PRIMARY_FILE)
         nameList.append(PRIMARYDB_FILE)
     for name in nameList:
         fileName = self._getRepoDataDir() + '/' + name
         if not file_util.exists(fileName + '.tmp'):
             continue
         if success:
             if not file_util.rename(fileName + '.tmp', fileName):
                 return False
         else:
             if not file_util.remove(fileName + '.tmp'):
                 return False
         if not file_util.remove(fileName + '.gz'):
             return False
     return True
コード例 #17
0
ファイル: cache_handler.py プロジェクト: luckylecher/cpp
 def _processTmpFile(self, cacheType, success):
     nameList = []
     if cacheType == PRIMARY_TYPE:
         nameList.append(PRIMARY_FILE)
     elif cacheType == PRIMARYDB_TYPE:
         nameList.append(PRIMARYDB_FILE)
     elif cacheType == ALL_TYPE:
         nameList.append(PRIMARY_FILE)
         nameList.append(PRIMARYDB_FILE)
     for name in nameList:
         fileName = self._getRepoDataDir() + '/' + name
         if not file_util.exists(fileName + '.tmp'):
             continue
         if success:
             if not file_util.rename(fileName + '.tmp', fileName):
                 return False
         else:
             if not file_util.remove(fileName + '.tmp'):
                 return False
         if not file_util.remove(fileName + '.gz'):
             return False
     return True
コード例 #18
0
    def _linkPkgToRoot(self, rpmFileInfoList, linkList, mkdirList):
        for rpmFileInfo in rpmFileInfoList:
            items = rpmFileInfo.relativePath.split('/')
            if len(items) < 2:
                Log.cout(Log.ERROR,
                         'Invalid file path %s' % rpmFileInfo.relativePath)
                return False

            # disable dir check
            # if items[0] != 'ainst' and not self._ainstRoot.isInRootDir(items[0]):
            #     Log.cout(Log.ERROR, 'Invalid file path %s' % rpmFileInfo.relativePath)
            #     return False

            if rpmFileInfo.isDir:
                dirPath = self._ainstRoot.getRoot(
                ) + '/' + rpmFileInfo.relativePath
                ret, dirList = file_util.makeDir2(dirPath)
                if not ret:
                    Log.cout(Log.ERROR, 'Makedir %s failed' % dirName)
                    return False
                mkdirList.extend(dirList)
            else:
                srcPath = self._ainstPkgDir + '/' + rpmFileInfo.relativePath
                destPath = self._ainstRoot.getRoot(
                ) + '/' + rpmFileInfo.relativePath
                if not file_util.isLink(srcPath) and not file_util.exists(
                        srcPath):
                    Log.cout(Log.ERROR,
                             'Activate failed: not exists file %s' % srcPath)
                    return False
                if file_util.exists(destPath):
                    if self._isActiveFile(rpmFileInfo.relativePath) or\
                            not file_util.remove(destPath):
                        Log.cout(
                            Log.ERROR,
                            'File conflict %s, ignore and continue.' %
                            destPath)
                        continue
                dirPath = os.path.dirname(destPath)
                ret, dirList = file_util.makeDir2(dirPath)
                if not ret:
                    Log.cout(Log.ERROR, 'Makedir %s failed' % dirName)
                    return False
                mkdirList.extend(dirList)
                if not rpmFileInfo.isConfigFile():
                    if not file_util.link(srcPath, destPath):
                        return False
                    linkList.append(rpmFileInfo.relativePath)
        return True
コード例 #19
0
    def _generateConfigToRoot(self, rpmFileInfoList, aicfInfo, settingMap,
                              confSet):
        configGenerator = ConfigGenerator()
        if aicfInfo:
            for path, configInfo in aicfInfo.configs.iteritems():
                srcConfigPath = self._ainstPkgDir + '/' + path
                destConfigPath = self._ainstRoot.getRoot() + '/' + path
                if not file_util.isFile(srcConfigPath):
                    Log.cout(
                        Log.ERROR,
                        'Config file %s is not exists in pkg' % srcConfigPath)
                    return False
                if not file_util.remove(destConfigPath):
                    Log.cout(Log.ERROR,
                             'Remove path %s failed in pkg' % destConfigPath)
                    return False
                if not configGenerator.generateConfig(
                        srcConfigPath, destConfigPath, configInfo.mode,
                        configInfo.noReplace, settingMap):
                    Log.cout(Log.ERROR,
                             'Generate Config file %s failed' % path)
                    return False
                confSet.add(path)

        for rpmFileInfo in rpmFileInfoList:
            if rpmFileInfo.isConfigFile():
                path = rpmFileInfo.relativePath
                if path in confSet:
                    continue
                srcConfigPath = self._ainstPkgDir + '/' + path
                destConfigPath = self._ainstRoot.getRoot() + '/' + path
                if not file_util.isFile(srcConfigPath):
                    Log.cout(
                        Log.ERROR,
                        'Config file %s is not exists in pkg' % srcConfigPath)
                    return False
                if not configGenerator.generateConfig(srcConfigPath,
                                                      destConfigPath):
                    Log.cout(Log.ERROR,
                             'Generate Config file %s failed' % path)
                    return False
                confSet.add(path)

        return True
コード例 #20
0
 def _removeDir(self, dirName, rmdirList, recursive=True):
     if not dirName or not dirName.startswith(self._ainstRoot.getRoot()):
         Log.cout(Log.ERROR, 'Remove invalid path %s' % dirName)
         return False
     if dirName[-1] != '/':
         dirName += '/'
     if self._ainstRoot.isAinstDir(dirName):
         Log.cout(Log.DEBUG, 'Ainst root path %s need not remove' % dirName)
         return True
     subDirs = file_util.listDir(dirName)
     if subDirs is not None and len(subDirs) == 0:
         if not file_util.remove(dirName):
             Log.cout(Log.ERROR, 'Remove dir %s failed' % dirName)
             return False
         rmdirList.append(dirName)
         if recursive:
             dirPath = os.path.dirname(dirName[:-1])
             return self._removeDir(dirPath, rmdirList, recursive)
     return True
コード例 #21
0
    def _initRoot(self, initTrace):
        for name in self._rootDirs:
            if file_util.isDir(self._rootDirs[name]):
                continue
            if not file_util.makeDir(self._rootDirs[name]):
                self.clearInit(initTrace)
                return False
            initTrace.append(self._rootDirs[name])

        for name in self._rootVarDirs:
            if file_util.isDir(self._rootVarDirs[name]):
                continue
            if not file_util.makeDir(self._rootVarDirs[name]):
                self.clearInit(initTrace)
                return False
            initTrace.append(self._rootVarDirs[name])

        for name in self._rootVarAinstDirs:
            if file_util.isDir(self._rootVarAinstDirs[name]):
                continue
            if not file_util.makeDir(self._rootVarAinstDirs[name]):
                self.clearInit(initTrace)
                return False
            initTrace.append(self._rootVarAinstDirs[name])

        initRootState = self._rootVarAinstDirs['save'] + 'root-state-0'
        if not file_util.exists(initRootState):
            state = RootState(time.time(), '', self._root,
                              common.AINST_VERSION, [], {})
            content = RootStateStreamer().toString(state)
            if not content or not file_util.writeToFile(initRootState, content):
                self.clearInit(initTrace)
                return False
            initTrace.append(initRootState)

        if not self._clearTmp:
            if not file_util.remove(self._rootVarAinstDirs['tmp']) or\
                    not file_util.makeDir(self._rootVarAinstDirs['tmp']):
                self.clearInit(initTrace)
                return False
            self._clearTmp = True
        return True
コード例 #22
0
    def _generateCrontabFile(self):
        if not self._aicfInfo or not self._aicfInfo.crontabs:
            return True

        content = ''
        content += self._ainstRoot.getInstallRootEnvKey() + \
            '=' + self._ainstRoot.getRoot() + '\n'
        ainstPath = self._ainstPkgDir + '/ainst/'
        content += self._ainstDirKey + '=' + ainstPath + '\n'
        for crontab in self._aicfInfo.crontabs:
            content += crontab + '\n'

        crontabFile = self._ainstRoot.getRootVarDir('cron') + self._pkg.name
        if not file_util.remove(crontabFile) or\
                not file_util.writeToFile(crontabFile, content):
            Log.cout(Log.ERROR,
                     'Generate crontab file %s failed' % crontabFile)
            return False
        self._generatedCrontab = True
        return True
コード例 #23
0
ファイル: cache_handler.py プロジェクト: luckylecher/cpp
 def _doMakeCache(self, metatype):
     #download repomd.xml to repomd.xml.tmp
     repomdTmpFile = self._getRepoDataDir() + '/' + \
         self.repomdLocation.split('/')[-1] + ".tmp"
     repomdUrl = self.repoConfig.baseurl + self.repomdLocation
     if not file_util.remove(repomdTmpFile) or \
             not self.fileFetcher.fetch(repomdUrl, repomdTmpFile) or\
             not file_util.chmod(repomdTmpFile, 0666):
         return False
     repoMdObj = RepoMdParser().parse(repomdTmpFile)
     if not repoMdObj:
         return False
     metatype = self._filterMetaTypeByRepoMD(metatype, repoMdObj)
     if metatype == PRIMARY_TYPE:
         return self._getMetaFile(repoMdObj, PRIMARY_NAME, PRIMARY_FILE)
     elif metatype == PRIMARYDB_TYPE:
         return self._getMetaFile(repoMdObj, PRIMARYDB_NAME, PRIMARYDB_FILE)
     elif metatype == ALL_TYPE:
         return self._getMetaFile(repoMdObj, PRIMARY_NAME, PRIMARY_FILE) and \
             self._getMetaFile(repoMdObj, PRIMARYDB_NAME, PRIMARYDB_FILE)
     else:
         return False
コード例 #24
0
 def _unlinkPkgFromRoot(self, rpmFileInfoList, unlinkList, rmdirList, confDict):
     if self._aicfInfo:
         for path in self._aicfInfo.configs.keys():
             destConfigPath = self._ainstRoot.getRoot() + '/' + path
             if file_util.isFile(destConfigPath):
                 tmpDirName = self._ainstRoot.getRootVarAinstDir('tmp')
                 tmpPath = tmpDirName + '/' + os.path.basename(destConfigPath) + '.tmp'
                 if not file_util.move(destConfigPath, tmpPath):
                     return False
                 confDict[path] = (tmpPath, destConfigPath)
                 dirName = os.path.dirname(destConfigPath) + '/'
                 if not self._removeDir(dirName, rmdirList):
                     return False
     for rpmFileInfo in rpmFileInfoList:
         srcPath = self._ainstPkgDir + '/' + rpmFileInfo.relativePath
         destPath = self._ainstRoot.getRoot() + '/' + rpmFileInfo.relativePath
         if rpmFileInfo.isDir:
             if not self._removeDir(destPath, rmdirList, False):
                 return False
         elif not rpmFileInfo.isConfigFile():
             if not file_util.remove(destPath):
                 return False
             unlinkList.append((srcPath, destPath))
             if not self._removeDir(os.path.dirname(destPath) + '/', rmdirList):
                 return False
         else:
             if confDict.has_key(rpmFileInfo.relativePath):
                 continue
             if file_util.isFile(destPath):
                 dirName = self._ainstRoot.getRootVarAinstDir('tmp')
                 tmpPath = dirName + os.path.basename(destPath) + '.tmp'
                 if not file_util.move(destPath, tmpPath):
                     return False
                 confDict[rpmFileInfo.relativePath] = (tmpPath, destPath)
                 if not self._removeDir(os.path.dirname(destPath) + '/', rmdirList):
                     return False
     return True
コード例 #25
0
 def _unSymlinkFromActive(self, ainstActivePkg):
     if file_util.isLink(ainstActivePkg):
         lastActivePkg = file_util.readLink(ainstActivePkg)
     if not file_util.remove(ainstActivePkg):
         return False, None
     return True, lastActivePkg
コード例 #26
0
ファイル: cache_handler.py プロジェクト: luckylecher/cpp
 def _onMakeCacheFailed(self, cacheType):
     repomdTmpFile = self._getRepoDataDir() + '/' + \
         self.repomdLocation.split('/')[-1];
     if not file_util.remove(repomdTmpFile + '.tmp'):
         return False
     return self._processTmpFile(cacheType, False)
コード例 #27
0
    def undo(self):
        if self._dryrun:
            return True
        if not self._executed:
            return False
        Log.cout(Log.INFO, 'Undo activate pkg %s ...' % self._pkg)
        if self._success:
            if not self._noExecute and not self._noStart and self._aicfInfo and\
                    self._aicfInfo.autoStart and self._aicfInfo.scripts.has_key('stop'):
                scriptContent = self._aicfInfo.scripts['stop']
                if scriptContent:
                    self._exportToEnv(self._ainstPathEnv)
                    self._exportToEnv(self._settingsEnv)
                    self._processScript(scriptContent)
                    self._removeFromEnv(self._settingsEnv)
                    self._removeFromEnv(self._ainstPathEnv)

            if not self._noExecute and not self._processScriptByName(
                    'pre-deactivate'):
                return False

        # roll back symlink to active
        if self._linkToActive:
            if not file_util.remove(self._ainstActivePkg):
                return False
        if self._lastActivePkg:
            if not file_util.link(self._lastActivePkg, self._ainstActivePkg):
                return False

        if self._generatedCrontab:
            crontabFile = self._ainstRoot.getRootVarDir(
                'cron') + self._pkg.name
            if not file_util.remove(crontabFile):
                return False

        if self._modifyDb:
            if not self._removeFileFromDb():
                return False

        if self._backSettings is not None:
            settingPath = self._ainstRoot.getRootVarAinstDir(
                'settings') + self._pkg.name
            if not SettingStreamer().dump(self._backSettings, settingPath):
                Log.cout(Log.ERROR,
                         'Save settings of pkg %s failed' % self._pkg)
                return False

        #roll back config file
        for path in self._confSet:
            if not file_util.remove(self._ainstRoot.getRoot() + '/' + path):
                return False

        # roll back link to root
        for dest in self._linkList[::-1]:
            destPath = self._ainstRoot.getRoot() + '/' + dest
            if not file_util.remove(destPath):
                return False
        for destDir in self._mkdirList[::-1]:
            if not file_util.remove(destDir):
                return False

        if self._success:
            if not self._noExecute and not self._processScriptByName(
                    'post-deactivate'):
                return False

        self._init()
        return True
コード例 #28
0
 def clearCache(self):
     return file_util.remove(self._getRepoDataDir())
コード例 #29
0
ファイル: cache_handler.py プロジェクト: luckylecher/cpp
 def clearCache(self):
     return file_util.remove(self._getRepoDataDir())
コード例 #30
0
 def _onMakeCacheFailed(self, cacheType):
     repomdTmpFile = self._getRepoDataDir() + '/' + \
         self.repomdLocation.split('/')[-1]
     if not file_util.remove(repomdTmpFile + '.tmp'):
         return False
     return self._processTmpFile(cacheType, False)
コード例 #31
0
 def clearInit(self, initTrace):
     for path in initTrace[::-1]:
         file_util.remove(path)
     self._inited = False
コード例 #32
0
ファイル: ainst_operator.py プロジェクト: luckylecher/cpp
 def _clearAllCache(self, cacheParam):
     if not file_util.remove(self._ainstConf.cachedir):
         Log.cout(Log.ERROR, 'clearAllCache failed')
         return OperatorRet.OPERATE_FAILED
     return OperatorRet.OPERATE_SUCCESS
コード例 #33
0
ファイル: ainst_operator.py プロジェクト: luckylecher/cpp
 def _clearAllCache(self, cacheParam):
     if not file_util.remove(self._ainstConf.cachedir):
         Log.cout(Log.ERROR, 'clearAllCache failed')
         return OperatorRet.OPERATE_FAILED
     return OperatorRet.OPERATE_SUCCESS