From e3b700666cf2b9ac2240e9d8cd5563aa4a02a003 Mon Sep 17 00:00:00 2001 From: Anam Navied Date: Fri, 20 Dec 2024 14:59:29 -0500 Subject: [PATCH] Parse out ModuleList for dependencies if it exists in metadata --- src/code/PSResourceInfo.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/code/PSResourceInfo.cs b/src/code/PSResourceInfo.cs index 0e14f6ce9..db88bfa8a 100644 --- a/src/code/PSResourceInfo.cs +++ b/src/code/PSResourceInfo.cs @@ -970,13 +970,18 @@ public static bool TryConvertFromContainerRegistryJson( { metadata["Dependencies"] = ParseContainerRegistryDependencies(requiredModulesElement, out errorMsg).ToArray(); } + if (string.Equals(packageName, "Az", StringComparison.OrdinalIgnoreCase) || packageName.StartsWith("Az.", StringComparison.OrdinalIgnoreCase)) { - if (rootDom.TryGetProperty("PrivateData", out JsonElement privateDataElement) && privateDataElement.TryGetProperty("PSData", out JsonElement psDataElement)) + if (rootDom.TryGetProperty("ModuleList", out JsonElement moduleListDepsElement)) + { + metadata["Dependencies"] = ParseContainerRegistryDependencies(moduleListDepsElement, out errorMsg).ToArray(); + } + else if (rootDom.TryGetProperty("PrivateData", out JsonElement privateDataElement) && privateDataElement.TryGetProperty("PSData", out JsonElement psDataElement)) { - if (psDataElement.TryGetProperty("ModuleList", out JsonElement moduleListDepsElement)) + if (psDataElement.TryGetProperty("ModuleList", out JsonElement privateDataModuleListDepsElement)) { - metadata["Dependencies"] = ParseContainerRegistryDependencies(moduleListDepsElement, out errorMsg).ToArray(); + metadata["Dependencies"] = ParseContainerRegistryDependencies(privateDataModuleListDepsElement, out errorMsg).ToArray(); } } }