Skip to content

Commit c49c1d8

Browse files
committed
Fix Get-ResourceProviderLocation
1 parent 2b581cf commit c49c1d8

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/ComputeTestCommon.ps1

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -398,27 +398,29 @@ function Get-SasUri
398398
# Get a Location according to resource provider.
399399
function Get-ResourceProviderLocation
400400
{
401-
if ([Microsoft.Azure.Test.HttpRecorder.HttpMockServer]::Mode -ne [Microsoft.Azure.Test.HttpRecorder.HttpRecorderMode]::Playback)
402-
{
403-
$namespace = $provider.Split("/")[0]
404-
if($provider.Contains("/"))
405-
{
406-
$type = $provider.Substring($namespace.Length + 1)
407-
$location = Get-AzureRmResourceProvider -ProviderNamespace $namespace | where {$_.ResourceTypes[0].ResourceTypeName -eq $type}
401+
param ([string] $provider)
402+
if ([Microsoft.Azure.Test.HttpRecorder.HttpMockServer]::Mode -ne [Microsoft.Azure.Test.HttpRecorder.HttpRecorderMode]::Playback)
403+
{
404+
$namespace = $provider.Split("/")[0]
405+
if($provider.Contains("/"))
406+
{
407+
$type = $provider.Substring($namespace.Length + 1)
408+
$location = Get-AzureRmResourceProvider -ProviderNamespace $namespace | where {$_.ResourceTypes[0].ResourceTypeName -eq $type}
408409

409-
if ($location -eq $null)
410-
{
411-
return "West US"
412-
} else
413-
{
414-
return $location.Locations[0]
415-
}
416-
}
410+
if ($location -eq $null)
411+
{
412+
return "West US"
413+
}
414+
else
415+
{
416+
return $location.Locations[0]
417+
}
418+
}
417419

418-
return "West US"
419-
}
420+
return "West US"
421+
}
420422

421-
return "WestUS"
423+
return "WestUS"
422424
}
423425

424426
function Get-ComputeVMLocation

0 commit comments

Comments
 (0)