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


TypeScript Kudu.getFileContent方法代码示例

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


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

示例1: _preZipDeployOperation

 private async _preZipDeployOperation(): Promise<void> {
     try {
         tl.debug('ZIP DEPLOY - Performing pre-zipdeploy operation.');
         let activeDeploymentID: string = await this._appServiceKuduService.getFileContent(deploymentFolder, 'active');
         if(!!activeDeploymentID) {
             let activeDeploymentFolder: string = `${deploymentFolder}/${activeDeploymentID}`;
             tl.debug(`Active Deployment ID: '${activeDeploymentID}'. Deployment Folder: '${activeDeploymentFolder}'`);
             let manifestFileContent: string = await this._appServiceKuduService.getFileContent(activeDeploymentFolder, manifestFileName);
             if(!manifestFileContent) {
                 tl.debug(`No Manifest file present. Creating a empty manifest file in '${activeDeploymentFolder}' directory.`);
                 var tempManifestFile: string = path.join(tl.getVariable('AGENT.TEMPDIRECTORY'), manifestFileName);
                 tl.writeFile(tempManifestFile, '');
                 await this._appServiceKuduService.uploadFile(`${activeDeploymentFolder}`, manifestFileName, tempManifestFile);
                 tl.debug(`Manifest file created in '${activeDeploymentFolder}' directory.`);
             }
             else {
                 tl.debug('Manifest file present in active deployment directory. Skip creating a new one.');
             }
             tl.debug('ZIP DEPLOY - Performed pre-zipdeploy operation.');
         }
     }
     catch(error) {
         tl.debug(`Failed to execute pre zip-deploy operation: ${JSON.stringify(error)}.`);
     }
 }
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:25,代码来源:KuduServiceUtility.ts

示例2: _pollForFile

    private async _pollForFile(physicalPath: string, fileName: string, timeOutInMinutes: number): Promise<void> {
        var attempts: number = 0;
        const retryInterval: number = 10;
        if(tl.getVariable('appservicedeploy.retrytimeout')) {
            timeOutInMinutes = Number(tl.getVariable('appservicedeploy.retrytimeout'));
            tl.debug('Retry timeout in minutes provided by user: ' + timeOutInMinutes);
        }

        var timeOutInSeconds = timeOutInMinutes * 60;
        var noOfRetry = timeOutInSeconds / retryInterval;

        tl.debug(`Polling started for file:  ${fileName} with retry count: ${noOfRetry}`);

        while (attempts < noOfRetry) {
            attempts += 1;
            var fileContent: string = await this._appServiceKuduService.getFileContent(physicalPath, fileName);
            if(fileContent == null) {
                tl.debug('File: ' + fileName + ' not found. retry after 10 seconds. Attempt: ' + attempts);
                await webClient.sleepFor(10);
            }
            else {
                tl.debug('Found file:  ' + fileName);
                return ;
            }
        }

        if(attempts == noOfRetry) {
            throw new Error(tl.loc('ScriptStatusTimeout'));
        }
    }
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:30,代码来源:KuduServiceUtility.ts

示例3: _printPostDeploymentLogs

    private async _printPostDeploymentLogs(physicalPath: string, uniqueID: string) : Promise<void> {
        var stdoutLog = await this._appServiceKuduService.getFileContent(physicalPath, 'stdout_' + uniqueID + '.txt');
        var stderrLog = await this._appServiceKuduService.getFileContent(physicalPath, 'stderr_' + uniqueID + '.txt');
        var scriptReturnCode = await this._appServiceKuduService.getFileContent(physicalPath, 'script_result_' + uniqueID + '.txt');

        if(scriptReturnCode == null) {
            throw new Error('File not found in Kudu Service. ' + 'script_result_' + uniqueID + '.txt');
        }

        if(stdoutLog) {
            console.log(tl.loc('stdoutFromScript'));
            console.log(stdoutLog);
        }
        if(stderrLog) {
            console.log(tl.loc('stderrFromScript'));
            if(scriptReturnCode != '0') {
                tl.error(stderrLog);
                throw Error(tl.loc('ScriptExecutionOnKuduFailed', scriptReturnCode, stderrLog));
            }
            else {
                console.log(stderrLog);
            }
        }
    }
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:24,代码来源:KuduServiceUtility.ts

示例4: postZipDeployOperation

 public async postZipDeployOperation(oldDeploymentID: string, activeDeploymentID: string): Promise<void> {
     try {
         tl.debug(`ZIP DEPLOY - Performing post zip-deploy operation: ${oldDeploymentID} => ${activeDeploymentID}`);
         let manifestFileContent = await this._appServiceKuduService.getFileContent(`${deploymentFolder}/${oldDeploymentID}`, manifestFileName);
         if(!!manifestFileContent) {
             let tempManifestFile: string = path.join(tl.getVariable('AGENT.TEMPDIRECTORY'), manifestFileName);
             tl.writeFile(tempManifestFile, manifestFileContent);
             await this._appServiceKuduService.uploadFile(`${deploymentFolder}/${activeDeploymentID}`, manifestFileName, tempManifestFile);
         }
         tl.debug('ZIP DEPLOY - Performed post-zipdeploy operation.');
     }
     catch(error) {
         tl.debug(`Failed to execute post zip-deploy operation: ${JSON.stringify(error)}.`);
     }
 }
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:15,代码来源:KuduServiceUtility.ts


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