diff --git a/src/NuGet.Jobs.RegistrationComparer/HiveComparer.cs b/src/NuGet.Jobs.RegistrationComparer/HiveComparer.cs index 8872b0b52..eeeafa88e 100644 --- a/src/NuGet.Jobs.RegistrationComparer/HiveComparer.cs +++ b/src/NuGet.Jobs.RegistrationComparer/HiveComparer.cs @@ -159,7 +159,7 @@ await ParallelAsync.Repeat( } catch (InvalidOperationException ex) { - ResultWriter.WriteWarning(ex.Message); + _logger.LogWarning(ex.Message); continue; } diff --git a/src/NuGet.Jobs.RegistrationComparer/NuGet.Jobs.RegistrationComparer.csproj b/src/NuGet.Jobs.RegistrationComparer/NuGet.Jobs.RegistrationComparer.csproj index abc5779c6..5dc619f5e 100644 --- a/src/NuGet.Jobs.RegistrationComparer/NuGet.Jobs.RegistrationComparer.csproj +++ b/src/NuGet.Jobs.RegistrationComparer/NuGet.Jobs.RegistrationComparer.csproj @@ -54,7 +54,6 @@ - diff --git a/src/NuGet.Jobs.RegistrationComparer/RegistrationComparerCollectorLogic.cs b/src/NuGet.Jobs.RegistrationComparer/RegistrationComparerCollectorLogic.cs index a8a3a509c..2de68904e 100644 --- a/src/NuGet.Jobs.RegistrationComparer/RegistrationComparerCollectorLogic.cs +++ b/src/NuGet.Jobs.RegistrationComparer/RegistrationComparerCollectorLogic.cs @@ -88,7 +88,6 @@ public async Task OnProcessBatchAsync(IEnumerable items) catch (Exception ex) { Interlocked.Increment(ref failures); - ResultWriter.WriteError(ex.Message.ToString()); _logger.LogError(ex, "The comparison failed."); } }); diff --git a/src/NuGet.Jobs.RegistrationComparer/RegistrationComparerCommand.cs b/src/NuGet.Jobs.RegistrationComparer/RegistrationComparerCommand.cs index ab502099a..b16b11f87 100644 --- a/src/NuGet.Jobs.RegistrationComparer/RegistrationComparerCommand.cs +++ b/src/NuGet.Jobs.RegistrationComparer/RegistrationComparerCommand.cs @@ -8,6 +8,7 @@ using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using Microsoft.WindowsAzure.Storage; +using Microsoft.WindowsAzure.Storage.Blob; using NuGet.Services.Metadata.Catalog; using NuGet.Services.Metadata.Catalog.Persistence; using NuGet.Services.V3; @@ -48,10 +49,11 @@ public async Task ExecuteAsync(CancellationToken token) _logger.LogInformation("Using cursor: {CursurUrl}", frontCursorPair.Key); var frontCursor = frontCursorPair.Value; - await _storageAccount + var container = _storageAccount .CreateCloudBlobClient() - .GetContainerReference(_options.Value.StorageContainer) - .CreateIfNotExistsAsync(); + .GetContainerReference(_options.Value.StorageContainer); + await container.CreateIfNotExistsAsync(); + await container.SetPermissionsAsync(new BlobContainerPermissions { PublicAccess = BlobContainerPublicAccessType.Blob }); await frontCursor.LoadAsync(token); await backCursor.LoadAsync(token); diff --git a/src/NuGet.Jobs.RegistrationComparer/ResultWriter.cs b/src/NuGet.Jobs.RegistrationComparer/ResultWriter.cs deleted file mode 100644 index 4bf59ad1d..000000000 --- a/src/NuGet.Jobs.RegistrationComparer/ResultWriter.cs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.IO; - -namespace NuGet.Jobs.RegistrationComparer -{ - public static class ResultWriter - { - private static readonly object _warningsLock = new object(); - private static readonly object _errorsLock = new object(); - - public static void WriteWarning(string message) - { - lock (_warningsLock) - { - File.AppendAllLines("warnings.txt", new[] { message.Trim(), Environment.NewLine }); - } - } - - public static void WriteError(string message) - { - lock (_errorsLock) - { - File.AppendAllLines("errors.txt", new[] { message.Trim(), Environment.NewLine }); - } - } - } -}