Skip to content

Commit

Permalink
Updates for feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
JimSuplizio authored and azure-sdk committed Oct 22, 2024
1 parent a22ca8c commit be1ead0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
20 changes: 10 additions & 10 deletions eng/common/scripts/Helpers/Package-Helpers.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ CompatibleConvertFrom-Yaml call or $null if there was an issue with the convert.
The full path of the yml file to load.
.EXAMPLE
CompatibleLoadAndConvertFrom-Yaml -YmlFile path/to/file.yml
LoadFrom-Yaml -YmlFile path/to/file.yml
#>
function LoadAndCompatibleConvertFrom-Yaml {
function LoadFrom-Yaml {
param(
[Parameter(Mandatory=$true)]
[string]$YmlFile
Expand All @@ -122,11 +122,11 @@ function LoadAndCompatibleConvertFrom-Yaml {
return Get-Content -Raw -Path $YmlFile | CompatibleConvertFrom-Yaml
}
catch {
Write-Host "CompatibleLoadAndConvertFrom-Yaml::Exception while parsing yml file $($YmlFile): $_"
Write-Host "LoadFrom-Yaml::Exception while parsing yml file $($YmlFile): $_"
}
}
else {
Write-Host "CompatibleLoadAndConvertFrom-Yaml::YmlFile '$YmlFile' does not exist."
Write-Host "LoadFrom-Yaml::YmlFile '$YmlFile' does not exist."
}
return $null
}
Expand All @@ -139,17 +139,17 @@ return the value if it exist or null if it doesn't.
.DESCRIPTION
The Yaml file needs to be loaded via CompatibleConvertFrom-Yaml which returns the file as
as hashtable. The Keys are basically the path in the yaml file whose value to return, or
null if it doesn't exist. This function does is safely traverses the path, outputting an
error if there's an issue or returning the object representing the result if successful.
This function loops through the Keys safely trying to get values, checking each piece of
the path to ensure it exists. Normally one would just do
null if it doesn't exist. This function safely traverses the path, outputting an error
if there's an issue or returning the object representing the result if successful. This
function loops through the Keys safely trying to get values, checking each piece of the
path to ensure it exists. Normally one would just do
$Yml["extends"]["parameters"]["artifacts"]
but if something was off it would throw. Doing it this way allows more succinct error
reporting if a piece of the path didn't exist
.PARAMETER YamlContentAsHashtable
The hashtable representing the yaml file contents loaded through LoadAndCompatibleConvertFrom-Yaml
or CompatibleConvertFrom-Yaml, which is what LoadAndCompatibleConvertFrom-Yaml calls.
The hashtable representing the yaml file contents loaded through LoadFrom-Yaml
or CompatibleConvertFrom-Yaml, which is what LoadFrom-Yaml calls.
.PARAMETER Keys
String array representation of the path in the yaml file whose value we're trying to retrieve.
Expand Down
2 changes: 1 addition & 1 deletion eng/common/scripts/Package-Properties.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class PackageProps

hidden [HashTable]ParseYmlForArtifact([string]$ymlPath) {

$content = LoadAndCompatibleConvertFrom-Yaml $ymlPath
$content = LoadFrom-Yaml $ymlPath
if ($content) {
$artifacts = GetValueSafelyFrom-Yaml $content @("extends", "parameters", "Artifacts")
$artifactForCurrentPackage = $null
Expand Down

0 comments on commit be1ead0

Please sign in to comment.