Skip to content

Commit

Permalink
Parse out ModuleList for dependencies if it exists in metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
anamnavi committed Dec 20, 2024
1 parent 3e23ecb commit e3b7006
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/code/PSResourceInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
}
Expand Down

0 comments on commit e3b7006

Please sign in to comment.