You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I came across a condition where the else throw statement in Get-SHRLatestImageVersion.ps1 causes the function to fail. In my case I want to provide only an image definition in my build parameters and not a specific version as in your example.
I'm providing a valid input but it doesn't match the $imageVersionResourceIdPattern. The function fails at the throw, but by simply removing this else block I'm able to build from the gallery without issue.
if ($ImageReference.Id-match$imageVersionResourceIdPattern ) {
Write-PSFMessage-Level Host -Message 'Image reference is an Image Version resource.'$imageVersion=Get-AzGalleryImageVersion-ResourceId $ImageReference.Id$azImageVersion=$imageVersion.Name$azImageDate=$imageVersion.PublishingProfile.PublishedDateWrite-PSFMessage-Level Host -Message "Image version is {0} and date is {1}"-StringValues $azImageVersion,$azImageDate.ToString('o')
}
#else {# throw "Image reference Id does not match expected format for an Image Definition resource."# }
I'd assume the other final else throw block should be sufficient for error handling?
else {
throw"Image reference does not contain a publisher or Id property. ImageReference, publisher, and Id are case sensitive!!"
}
The text was updated successfully, but these errors were encountered:
The PR only addressed the custom App Plan feature and fixed the Regex, I didn't want to remove the 'else throw' block without flagging it here to you first.
I'd suggest we simply remove the 'else throw' block entirely from the Get-SHRLatestImageVersion.ps1 at lines 81-83 or we need to duplicate the entire blocks above which seems a little redundant and uses an additional parameter to differentiate between Shared Image Gallery Types.
Hi Walid,
I came across a condition where the else throw statement in Get-SHRLatestImageVersion.ps1 causes the function to fail. In my case I want to provide only an image definition in my build parameters and not a specific version as in your example.
I'm providing a valid input but it doesn't match the $imageVersionResourceIdPattern. The function fails at the throw, but by simply removing this else block I'm able to build from the gallery without issue.
I'd assume the other final else throw block should be sufficient for error handling?
The text was updated successfully, but these errors were encountered: