IcM repair fixes for sideloading script (#512)
* IcM repair fixes for sideloading script * check only required properties are not null * fix CR comments
This commit is contained in:
Родитель
6625d9824a
Коммит
2a9ef12f55
|
@ -576,6 +576,11 @@ function DownloadMarketplaceProduct {
|
|||
} else {
|
||||
& 'C:\Program Files (x86)\Microsoft SDKs\Azure\AzCopy\AzCopy.exe' /Source:$Source /Dest:$tmpDestination /Y
|
||||
}
|
||||
## Check $LastExitcode to see if AzCopy Succeeded
|
||||
if ($LastExitCode -ne 0) {
|
||||
$downloadError = $_
|
||||
Write-Error "Unable downloading files using AzCopy: $downloadError LastExitCode: $LastExitCode" -ErrorAction Stop
|
||||
}
|
||||
} else {
|
||||
$wc = New-Object System.Net.WebClient
|
||||
$wc.DownloadFile($source, $tmpDestination)
|
||||
|
@ -682,6 +687,31 @@ function PreCheck
|
|||
Write-Warning ".marketplace file exists, these are temp files not fully downloaded. Please download product '$dir' again, then retry import"
|
||||
throw ".marketplace file exists"
|
||||
}
|
||||
|
||||
## Validate Json
|
||||
$jsonPath = "$folderPath\$dir.json"
|
||||
$configuration = Get-Content $jsonPath | ConvertFrom-Json
|
||||
$properties = ($configuration | Get-Member -MemberType NoteProperty).Name
|
||||
## define required properties
|
||||
$requiredprops = @("displayName","publisherDisplayName","publisherIdentifier","galleryPackageBlobSasUri", "offer", "offerVersion", "sku", "productProperties", "payloadLength", "iconUris", "productKind" )
|
||||
foreach ($property in $requiredprops) {
|
||||
if ($configuration.$property) {
|
||||
Write-Verbose -Message "$property = $($configuration.$property)"
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Error -Message "Property value for $property is null. Please check JSON contents, then retry import."
|
||||
throw "JSON file contains null values for required properties."
|
||||
}
|
||||
}
|
||||
|
||||
$iconUris = $configuration.iconUris
|
||||
|
||||
if ($iconUris.small -eq $null -or $iconUris.large -eq $null -or $iconUris.medium -eq $null -or $iconUris.wide -eq $null )
|
||||
{
|
||||
Write-Error -Message "Property value for certain Icons is null. Please check JSON contents, then retry import."
|
||||
throw "JSON file contains null values for certain Icons. Please ensure small, medium, large and wide icons exist in the JSON."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче