From 8c6e02779c0ee29641425e77fe214189d2fac83d Mon Sep 17 00:00:00 2001 From: Vinod Kumar Date: Thu, 15 Feb 2018 20:28:48 +0530 Subject: [PATCH] Added force remove application cmdlet in case of failure of remove (#6444) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Added force remove application cmdlet in case of failure of remove ap… (#6431) * Added force remove application cmdlet in case of failure of remove application cmdlet (#6413) * Added force remove application cmdlet in case of failure of remove application cmdlet * Added -Force parameter to avoid confirmation prompt * Indentation * Updated version number * fix failing test on hosted agent * Typo while merging --- .../Publish-NewServiceFabricApplication.ps1 | 15 +++++---------- Tasks/ServiceFabricDeploy/Tests/CreateDiffPkg.ps1 | 2 +- Tasks/ServiceFabricDeploy/task.json | 2 +- Tasks/ServiceFabricDeploy/task.loc.json | 2 +- 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/Tasks/ServiceFabricDeploy/ServiceFabricSDK/Publish-NewServiceFabricApplication.ps1 b/Tasks/ServiceFabricDeploy/ServiceFabricSDK/Publish-NewServiceFabricApplication.ps1 index f4b1db77112d..33b0ef3b3f57 100644 --- a/Tasks/ServiceFabricDeploy/ServiceFabricSDK/Publish-NewServiceFabricApplication.ps1 +++ b/Tasks/ServiceFabricDeploy/ServiceFabricSDK/Publish-NewServiceFabricApplication.ps1 @@ -209,17 +209,12 @@ Write-Host (Get-VstsLocString -Key SFSDK_AppAlreadyExistsInfo -ArgumentList @($ApplicationName, $app.ApplicationTypeName, $app.ApplicationTypeVersion)) try - { - $app | Remove-ServiceFabricApplication -Force - } - catch [System.TimeoutException] - { - # Catch operation timeout and continue with force remove replica. - } - - foreach ($node in Get-ServiceFabricNode) { - [void](Get-ServiceFabricDeployedReplica -NodeName $node.NodeName -ApplicationName $ApplicationName | Remove-ServiceFabricReplica -NodeName $node.NodeName -ForceRemove) + $app | Remove-ServiceFabricApplication -Force + } + catch [System.TimeoutException] + { + $app | Remove-ServiceFabricApplication -Force -ForceRemove } if($OverwriteBehavior.Equals("Always")) diff --git a/Tasks/ServiceFabricDeploy/Tests/CreateDiffPkg.ps1 b/Tasks/ServiceFabricDeploy/Tests/CreateDiffPkg.ps1 index 07d1b5c9eb90..498627ea073d 100644 --- a/Tasks/ServiceFabricDeploy/Tests/CreateDiffPkg.ps1 +++ b/Tasks/ServiceFabricDeploy/Tests/CreateDiffPkg.ps1 @@ -5,7 +5,7 @@ param() $publishProfilePath = "$PSScriptRoot\data\NoAuthPublishProfile.xml" $applicationPackagePath = "$PSScriptRoot\data\DiffPkgAssets\AppPkg" -$diffPackagePath = $env:TEMP + "\DiffPackage" +$diffPackagePath = (Get-Item $env:TEMP).FullName + "\DiffPackage" $serviceConnectionName = "random connection name" $serviceFabricSdkModulePath = "$PSScriptRoot\data\ServiceFabricSDK.ps1" $appName = "AppName" diff --git a/Tasks/ServiceFabricDeploy/task.json b/Tasks/ServiceFabricDeploy/task.json index 31f712a94446..bbafd90419bd 100644 --- a/Tasks/ServiceFabricDeploy/task.json +++ b/Tasks/ServiceFabricDeploy/task.json @@ -17,7 +17,7 @@ "version": { "Major": 1, "Minor": 6, - "Patch": 0 + "Patch": 1 }, "demands": [ "Cmd" diff --git a/Tasks/ServiceFabricDeploy/task.loc.json b/Tasks/ServiceFabricDeploy/task.loc.json index 90f21047e0d9..6776476c927d 100644 --- a/Tasks/ServiceFabricDeploy/task.loc.json +++ b/Tasks/ServiceFabricDeploy/task.loc.json @@ -17,7 +17,7 @@ "version": { "Major": 1, "Minor": 6, - "Patch": 0 + "Patch": 1 }, "demands": [ "Cmd"