Added option to ForceDeleteResources.
This commit is contained in:
Родитель
ef5584ac09
Коммит
e46f180cdc
|
@ -32,7 +32,8 @@ param (
|
|||
[string] $customKernel,
|
||||
[string] $customLIS,
|
||||
[string] $customLISBranch,
|
||||
[string] $resizeVMsAfterDeployment
|
||||
[string] $resizeVMsAfterDeployment,
|
||||
[switch] $ForceDeleteResources
|
||||
)
|
||||
|
||||
Import-Module .\TestLibs\AzureWinUtils.psm1 -Force -Scope Global
|
||||
|
@ -62,6 +63,10 @@ if($EnableAcceleratedNetworking)
|
|||
{
|
||||
Set-Variable -Name EnableAcceleratedNetworking -Value $true -Scope Global
|
||||
}
|
||||
if($ForceDeleteResources)
|
||||
{
|
||||
Set-Variable -Name ForceDeleteResources -Value $true -Scope Global
|
||||
}
|
||||
if($resizeVMsAfterDeployment)
|
||||
{
|
||||
Set-Variable -Name resizeVMsAfterDeployment -Value $resizeVMsAfterDeployment -Scope Global
|
||||
|
@ -87,6 +92,7 @@ if ( $RunSelectedTests )
|
|||
{
|
||||
Set-Variable -Name RunSelectedTests -Value $RunSelectedTests -Scope Global
|
||||
}
|
||||
|
||||
if ( $xmlConfig.config.Azure.General.StorageAccount -imatch "NewStorage_" )
|
||||
{
|
||||
$NewASMStorageAccountType = ($xmlConfig.config.Azure.General.StorageAccount).Replace("NewStorage_","")
|
||||
|
|
|
@ -593,8 +593,16 @@ Function CreateResourceGroupDeployment([string]$RGName, $location, $setupType, $
|
|||
}
|
||||
else
|
||||
{
|
||||
LogErr "Failed to Resource Group."
|
||||
$retValue = $false
|
||||
LogErr "Failed to create Resource Group - $RGName."
|
||||
if ($ForceDeleteResources)
|
||||
{
|
||||
LogMsg "-ForceDeleteResources is Set. Deleting $RGName."
|
||||
DeleteResourceGroup -RGName $RGName
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$VMsCreated = Get-AzureRmVM -ResourceGroupName $RGName
|
||||
if ( $VMsCreated )
|
||||
{
|
||||
|
@ -607,6 +615,7 @@ Function CreateResourceGroupDeployment([string]$RGName, $location, $setupType, $
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
$retValue = $false
|
||||
|
|
|
@ -2704,6 +2704,12 @@ Function DoTestCleanUp($result, $testName, $DeployedServices, $ResourceGroups, [
|
|||
$ResourceGroups = $ResourceGroups.Split("^")
|
||||
$isVMLogsCollected = $false
|
||||
foreach ($group in $ResourceGroups)
|
||||
{
|
||||
if ($ForceDeleteResources)
|
||||
{
|
||||
LogMsg "-ForceDeleteResources is Set. Deleting $group."
|
||||
}
|
||||
else
|
||||
{
|
||||
if($result -eq "PASS")
|
||||
{
|
||||
|
@ -2779,6 +2785,7 @@ Function DoTestCleanUp($result, $testName, $DeployedServices, $ResourceGroups, [
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LogMsg "Skipping cleanup, as No services / resource groups deployed for cleanup!"
|
||||
|
|
Загрузка…
Ссылка в новой задаче