diff --git a/.script/package-automation/package-generator.ps1 b/.script/package-automation/package-generator.ps1 index a714cc797cb..f4e51d6c815 100644 --- a/.script/package-automation/package-generator.ps1 +++ b/.script/package-automation/package-generator.ps1 @@ -49,11 +49,11 @@ try { $zipFileExist = $item -match ([regex]::Escape(".zip")) $pythonFileExist = $item -match ([regex]::Escape(".py")) $jsonFile = $item -match ([regex]::Escape(".json")) - $capsJsonFile = $item -match ([regex]::Escape(".JSON")) + if ($hostFileExist -or $proxiesFileExist -or $azureDeployFileExist -or $functionFileExist -or $textFileExist -or $zipFileExist -or $pythonFileExist) { } else { - if ($jsonFile -or $capsJsonFile) { + if ($jsonFile) { $newDataConnectorFilesWithoutExcludedFiles += $item } } diff --git a/Tools/Create-Azure-Sentinel-Solution/pipeline/createSolutionV4.ps1 b/Tools/Create-Azure-Sentinel-Solution/pipeline/createSolutionV4.ps1 index 834f53f2829..0f3bf36ab41 100644 --- a/Tools/Create-Azure-Sentinel-Solution/pipeline/createSolutionV4.ps1 +++ b/Tools/Create-Azure-Sentinel-Solution/pipeline/createSolutionV4.ps1 @@ -99,6 +99,7 @@ try foreach ($file in $filesList) { Write-Host "Current file is $file" + $fileExtension = $file -split '\.' | Select-Object -Last 1 if ($objectProperties.Name.ToLower() -eq "parsers") { $finalPath = "" + $pipelineBasePath + "Solutions/" + $pipelineSolutionName + "/Parsers/" + $file.Replace("Parsers/", "") @@ -140,12 +141,28 @@ try try { Write-Host "Downloading $finalPath" - $rawData = (New-Object System.Net.WebClient).DownloadString($finalPath) + $isFilePathPresent = Test-Path -Path "$finalPath" + Write-Host "Is $finalPath file path present $isFilePathPresent" + if ($isFilePathPresent) { + $rawData = (New-Object System.Net.WebClient).DownloadString($finalPath) + } + else { + if ($fileExtension -eq "json" -or $fileExtension -eq "JSON") { + Write-Host "FinalPath $finalPath not found!" + if ($fileExtension -eq "json") { + $finalPath = $finalPath.Replace(".json", ".JSON") + } else { + $finalPath = $finalPath.Replace(".JSON", ".json") + } + Write-Host "Updated FinalPath is $finalPath" + $rawData = (New-Object System.Net.WebClient).DownloadString($finalPath) + } + } } catch { Write-Host "Failed to download $finalPath -- Please ensure that it exists in $([System.Uri]::EscapeUriString($basePath))" -ForegroundColor Red Send-AppInsightsExceptionTelemetry -InstrumentationKey $instrumentationKey -Exception $_.Exception -CustomProperties @{ 'RunId'="$runId"; 'PullRequestNumber'= "$pullRequestNumber"; 'ErrorDetails'="CreateSolutionV4 : Error occured in catch block: $_"; 'EventName'="CreateSolutionV4" } - break; + exit 1; } try {