当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript Kudu.deleteFolder方法代码示例

本文整理汇总了TypeScript中azure-arm-rest/azure-arm-app-service-kudu.Kudu.deleteFolder方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Kudu.deleteFolder方法的具体用法?TypeScript Kudu.deleteFolder怎么用?TypeScript Kudu.deleteFolder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在azure-arm-rest/azure-arm-app-service-kudu.Kudu的用法示例。


在下文中一共展示了Kudu.deleteFolder方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: runPostDeploymentScript

    public async runPostDeploymentScript(taskParams: TaskParameters, directoryPath?: string): Promise<void> {  
        var uniqueID = this.getDeploymentID();
        let vstsPostDeploymentFolderPath: string = path.join(physicalRootPath.substring(1), '..', 'VSTS_PostDeployment_' + uniqueID);
        try {      
            var rootDirectoryPath = directoryPath || physicalRootPath.substring(1);

            if(taskParams.TakeAppOfflineFlag) {
                await this._appOfflineKuduService(rootDirectoryPath, true);
            }

            var scriptFile = this._getPostDeploymentScript(taskParams.ScriptType, taskParams.InlineScript, taskParams.ScriptPath, taskParams.isLinuxApp);
            var fileExtension : string = taskParams.isLinuxApp ? '.sh' : '.cmd';
            var mainCmdFilePath = path.join(__dirname, '..', 'postDeploymentScript', 'mainCmdFile' + fileExtension);
            await this._appServiceKuduService.uploadFile(vstsPostDeploymentFolderPath, 'mainCmdFile' + fileExtension, mainCmdFilePath);
            await this._appServiceKuduService.uploadFile(vstsPostDeploymentFolderPath, 'kuduPostDeploymentScript' + fileExtension, scriptFile.filePath);
            console.log(tl.loc('ExecuteScriptOnKudu'));
            var cmdFilePath = '%Home%\\site\\VSTS_PostDeployment_' + uniqueID + '\\mainCmdFile' + fileExtension;
            var scriprResultPath = '/site/VSTS_PostDeployment_' + uniqueID;
            if (taskParams.isLinuxApp){
                cmdFilePath = '/home/site/VSTS_PostDeployment_' + uniqueID + '/mainCmdFile' + fileExtension;
            }
            await this.runCommand(rootDirectoryPath, cmdFilePath + ' ' + uniqueID, 30, scriprResultPath, 'script_result.txt');
            await this._printPostDeploymentLogs(vstsPostDeploymentFolderPath);

        }
        catch(error) {
            if(taskParams.UseWebDeploy && taskParams.DeploymentType === DeploymentType.runFromZip) {
                var debugMode = tl.getVariable('system.debug');
                if(debugMode && debugMode.toLowerCase() == 'true') {
                    tl.warning(tl.loc('Publishusingrunfromzipwithpostdeploymentscript'));
                }
                else {
                    console.log(tl.loc('Publishusingrunfromzipwithpostdeploymentscript'));
                }
            }
            throw Error(tl.loc('FailedToRunScriptOnKuduError', error));
        }
        finally {
            try {
                let deleteFilePath = '%Home%\\site\\VSTS_PostDeployment_' + uniqueID + '\\delete_log_file' + fileExtension;
                if(taskParams.isLinuxApp) {
                    deleteFilePath = '/home/site/VSTS_PostDeployment_' + uniqueID + '/delete_log_file' + fileExtension;
                }
                
                await this._appServiceKuduService.uploadFile(vstsPostDeploymentFolderPath, 'delete_log_file' + fileExtension, path.join(__dirname, '..', 'postDeploymentScript', 'deleteLogFile' + fileExtension));
                await this.runCommand(vstsPostDeploymentFolderPath, deleteFilePath);
                await this._appServiceKuduService.deleteFolder(vstsPostDeploymentFolderPath);
            }
            catch(error) {
                tl.debug('Unable to delete log files : ' + error);
            }
            if(taskParams.TakeAppOfflineFlag) {
                await this._appOfflineKuduService(rootDirectoryPath, false);
            }
        }
    }
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:56,代码来源:KuduServiceUtility.ts


注:本文中的azure-arm-rest/azure-arm-app-service-kudu.Kudu.deleteFolder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。