54 lines
2.2 KiB
PowerShell
54 lines
2.2 KiB
PowerShell
function Test-AlkamiHotfixManifest10 {
|
|
<#
|
|
.SYNOPSIS
|
|
Please don't use this file by hand, please use Test-AlkamiManifest
|
|
This function is intended to validate the HotfixManifest dotted object/hashtable so we can ensure that the values provided meet a minimum standard of valid
|
|
|
|
.PARAMETER HotfixManifest
|
|
A dotted object ([xml](Get-Content -Path $somePath)) or hashtable of values
|
|
#>
|
|
[CmdletBinding()]
|
|
[OutputType([System.Collections.Hashtable])]
|
|
Param(
|
|
[Parameter(Position = 0, Mandatory = $true)]
|
|
[ValidateNotNullOrEmpty()]
|
|
[object]$HotfixManifest
|
|
)
|
|
|
|
$success = $true
|
|
$resultMessages = @()
|
|
|
|
if (Test-StringIsNullOrWhiteSpace -Value $HotfixManifest.fixedInOrbVersion) {
|
|
$resultMessages += 'The hotfix manifest target Version is missing. This is required and should be a valid version.'
|
|
$success = $false
|
|
} else {
|
|
try {
|
|
# Either this is a valid - and castable - version string, or it throws
|
|
[Version]$HotfixManifest.fixedInOrbVersion | Out-Null
|
|
} catch {
|
|
$resultMessages += 'The hotfix manifest target Version is not a valid Version object. This is required and should be a valid version.'
|
|
$success = $false
|
|
}
|
|
}
|
|
|
|
|
|
$serverTier = $HotfixManifest.serverTier
|
|
$validHotfixServerTiers = Get-ValidHotfixServerTiers
|
|
$validHotfixServerTiersString = $validHotfixServerTiers -join ","
|
|
|
|
if (Test-StringIsNullOrWhiteSpace -Value $serverTier) {
|
|
$resultMessages += "The hotfix manifest serverTier is missing. This is required and must be one of these values: $validHotfixServerTiersString"
|
|
# TODO: Will need to be revisited after 2022.4 release in the future (see also Get-PackageMetadataV2)
|
|
# Original 1.0 manifests did not have serverTier
|
|
# Null-or-Whitespace will mean Install-to-All-tiers until 2022.4 when hotfixes have serverTier node
|
|
#$success = $false
|
|
} elseif ($serverTier -notin $validHotfixServerTiers) {
|
|
$resultMessages += "The hotfix manifest serverTier is not a valid value. It must be one of these values: $validHotFixServerTiersString"
|
|
$success = $false
|
|
}
|
|
|
|
return @{
|
|
success = $success
|
|
results = $resultMessages
|
|
}
|
|
} |