當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript Kudu.listDir方法代碼示例

本文整理匯總了TypeScript中azure-arm-rest/azure-arm-app-service-kudu.Kudu.listDir方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Kudu.listDir方法的具體用法?TypeScript Kudu.listDir怎麽用?TypeScript Kudu.listDir使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在azure-arm-rest/azure-arm-app-service-kudu.Kudu的用法示例。


在下文中一共展示了Kudu.listDir方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: HasWarExpandedSuccessfully

export async function HasWarExpandedSuccessfully(kuduService: Kudu, directoryWithSameNameBeforeDeployment: any, warFileName: string, appServiceUtility: AzureAppServiceUtility): Promise<boolean> {
    // Waiting for war to expand
    await sleepFor(10);

    // do a get call on the target web app.
    await appServiceUtility.pingApplication();
    var filesAfterDeployment: any = await kuduService.listDir('/site/wwwroot/webapps/');
    tl.debug("Listing file structure of webapps folder after deployment has completed => " + JSON.stringify(filesAfterDeployment));

    // Verify if the content of that war file has successfully expanded. This is can be concluded if
    // directory with same name as war file exists after deployment and if it existed before deployment, then the directory should contain content of new war file
    // which can be concluded if the modified time of the directory has changed. We have however observerd some minor milliseconds change in the modified time even when deployment is not successfull, only for the first time. Hence we are introducing a check that the time change should be more than 0.5 second or 500 milliseconds.
    return filesAfterDeployment.some(item => { return item.name == warFileName && item.mime == "inode/directory" && (!directoryWithSameNameBeforeDeployment || (item.mtime != directoryWithSameNameBeforeDeployment.mtime && (new Date(item.mtime).getTime() - new Date(directoryWithSameNameBeforeDeployment.mtime).getTime() > 500))) });
}
開發者ID:Microsoft,項目名稱:vsts-tasks,代碼行數:14,代碼來源:WarDeploymentUtilities.ts

示例2: DeployWar

export async function DeployWar(webPackage, taskParams: TaskParameters, msDeployPublishingProfile, kuduService: Kudu, appServiceUtility: AzureAppServiceUtility): Promise<void> {
    // get list of files before deploying to the web app.
    await appServiceUtility.pingApplication();
    var listOfFilesBeforeDeployment: any = await kuduService.listDir('/site/wwwroot/webapps/');
    tl.debug("Listing file structure of webapps folder before deployment starts => " + JSON.stringify(listOfFilesBeforeDeployment));

    // Strip package path and only keep the package name.
    var warFileName = path.basename(webPackage).split('.war')[0];

    // Find if directory with same name as war file, existed before deployment
    var directoryWithSameNameBeforeDeployment;
    if (listOfFilesBeforeDeployment) {
        listOfFilesBeforeDeployment.some(item => {
            if (item.name == warFileName && item.mime == "inode/directory") {
                directoryWithSameNameBeforeDeployment = item;
                return true;
            }
            return false;
        });
    }

    var retryCount = 3;
    while (retryCount > 0) {
        await msDeploy.DeployUsingMSDeploy(webPackage, taskParams.WebAppName, msDeployPublishingProfile, taskParams.RemoveAdditionalFilesFlag,
            taskParams.ExcludeFilesFromAppDataFlag, taskParams.TakeAppOfflineFlag, taskParams.VirtualApplication, taskParams.SetParametersFile,
            taskParams.AdditionalArguments, false, taskParams.UseWebDeploy);

        // verify if the war file has expanded
        // if not expanded, deploy using msdeploy once more, to make it work.
        var hasWarExpandedSuccessfully: boolean = await HasWarExpandedSuccessfully(kuduService, directoryWithSameNameBeforeDeployment, warFileName, appServiceUtility);
        if (!hasWarExpandedSuccessfully) {
            console.log(tl.loc("WarDeploymentRetry"));
            // If the war file is exactly same, MSDeploy doesn't update the war file in webapp.
            // So by changing ModifiedTime, we ensure it will be updated.
            var currentTime = new Date(Date.now());
            var modifiedTime = new Date(Date.now());
            fs.utimesSync(webPackage, currentTime, modifiedTime);
        }
        else {
            break;
        }

        retryCount--;
    }
}
開發者ID:Microsoft,項目名稱:vsts-tasks,代碼行數:45,代碼來源:WarDeploymentUtilities.ts

示例3: createPathIfRequired

 public async createPathIfRequired(phsyicalPath: string): Promise<void> {
     var listDir = await this._appServiceKuduService.listDir(phsyicalPath);
     if(listDir == null) {
         await this._appServiceKuduService.createPath(phsyicalPath);
     }
 }
開發者ID:Microsoft,項目名稱:vsts-tasks,代碼行數:6,代碼來源:KuduServiceUtility.ts


注:本文中的azure-arm-rest/azure-arm-app-service-kudu.Kudu.listDir方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。