Merge all changes
This commit is contained in:
@@ -185,6 +185,11 @@ public sealed class AstraConnector : IFeedConnector
|
||||
/// </remarks>
|
||||
private async Task<string> FetchOvalDatabaseAsync(string version, CancellationToken cancellationToken)
|
||||
{
|
||||
if (_fetchService is null || _rawDocumentStorage is null)
|
||||
{
|
||||
throw new InvalidOperationException("Fetch and raw document storage services are required for OVAL database fetch");
|
||||
}
|
||||
|
||||
var uri = _options.BuildOvalDatabaseUri(version);
|
||||
|
||||
_logger.LogDebug("Fetching OVAL database for Astra Linux {Version} from {Uri}", version, uri);
|
||||
@@ -197,18 +202,24 @@ public sealed class AstraConnector : IFeedConnector
|
||||
|
||||
var result = await _fetchService.FetchAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
if (!result.IsSuccess || result.Document is null)
|
||||
if (result is null || !result.IsSuccess || result.Document is null)
|
||||
{
|
||||
throw new InvalidOperationException($"Failed to fetch OVAL database for version {version}");
|
||||
}
|
||||
|
||||
if (!result.Document.PayloadId.HasValue)
|
||||
var document = result.Document;
|
||||
|
||||
if (!document.PayloadId.HasValue)
|
||||
{
|
||||
throw new InvalidOperationException($"OVAL database document for version {version} has no payload");
|
||||
}
|
||||
|
||||
// Download the raw XML content
|
||||
var payloadBytes = await _rawDocumentStorage.DownloadAsync(result.Document.PayloadId.Value, cancellationToken).ConfigureAwait(false);
|
||||
var payloadBytes = await _rawDocumentStorage.DownloadAsync(document.PayloadId.Value, cancellationToken).ConfigureAwait(false);
|
||||
if (payloadBytes is null)
|
||||
{
|
||||
throw new InvalidOperationException($"OVAL database payload for version {version} not found");
|
||||
}
|
||||
return System.Text.Encoding.UTF8.GetString(payloadBytes);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user