Skip to content

Commit 1f15eed

Browse files
authored
Merge pull request #1792 from PowerShell/bugfix-mar-az-deps
Update ContainerRegistry dependency parsing logic to account for AzPreview package
2 parents 9c741e4 + d02dc4a commit 1f15eed

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/code/PSResourceInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -972,7 +972,7 @@ public static bool TryConvertFromContainerRegistryJson(
972972
metadata["Dependencies"] = ParseContainerRegistryDependencies(requiredModulesElement, out errorMsg).ToArray();
973973
}
974974

975-
if (string.Equals(packageName, "Az", StringComparison.OrdinalIgnoreCase) || packageName.StartsWith("Az.", StringComparison.OrdinalIgnoreCase))
975+
if (string.Equals(packageName, "Az", StringComparison.OrdinalIgnoreCase) || string.Equals(packageName, "Azpreview", StringComparison.OrdinalIgnoreCase) || packageName.StartsWith("Az.", StringComparison.OrdinalIgnoreCase))
976976
{
977977
if (rootDom.TryGetProperty("ModuleList", out JsonElement moduleListDepsElement))
978978
{

test/FindPSResourceTests/FindPSResourceContainerRegistryServer.Tests.ps1

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,11 @@ Describe 'Test Find-PSResource for MAR Repository' -tags 'CI' {
255255
$res.Dependencies[0].Name | Should -Be "Az.Accounts"
256256
}
257257

258+
It "Should find Azpreview resource and it's dependency given specific Name and Version" {
259+
$res = Find-PSResource -Name "Azpreview" -Version "13.2.0" -Repository "MAR"
260+
$res.Dependencies.Length | Should -Not -Be 0
261+
}
262+
258263
It "Should find resource with wildcard in Name" {
259264
$res = Find-PSResource -Name "Az.App*" -Repository "MAR"
260265
$res | Should -Not -BeNullOrEmpty

0 commit comments

Comments
 (0)