From da80793204f7616dbc76ad36b93bdb7670ea6a5c Mon Sep 17 00:00:00 2001 From: Qstick Date: Tue, 25 Feb 2020 21:49:14 -0500 Subject: [PATCH] Fixed: Check for EnableCompletedDownloadHandling Enabled, Not Defined --- .../Checks/ImportMechanismCheckFixture.cs | 10 ---- .../Checks/ImportMechanismCheck.cs | 48 +------------------ 2 files changed, 1 insertion(+), 57 deletions(-) diff --git a/src/NzbDrone.Core.Test/HealthCheck/Checks/ImportMechanismCheckFixture.cs b/src/NzbDrone.Core.Test/HealthCheck/Checks/ImportMechanismCheckFixture.cs index 4ca6a86d3..78e725d82 100644 --- a/src/NzbDrone.Core.Test/HealthCheck/Checks/ImportMechanismCheckFixture.cs +++ b/src/NzbDrone.Core.Test/HealthCheck/Checks/ImportMechanismCheckFixture.cs @@ -12,10 +12,6 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks { if (enabled.HasValue) { - Mocker.GetMock() - .Setup(s => s.IsDefined("EnableCompletedDownloadHandling")) - .Returns(true); - Mocker.GetMock() .SetupGet(s => s.EnableCompletedDownloadHandling) .Returns(enabled.Value); @@ -24,12 +20,6 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks [Test] public void should_return_warning_when_completed_download_handling_not_configured() - { - Subject.Check().ShouldBeWarning(); - } - - [Test] - public void should_return_warning_when_both_completeddownloadhandling_and_dronefactory_are_not_configured() { GivenCompletedDownloadHandling(false); diff --git a/src/NzbDrone.Core/HealthCheck/Checks/ImportMechanismCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/ImportMechanismCheck.cs index ebb0c2609..b201cf7c4 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/ImportMechanismCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/ImportMechanismCheck.cs @@ -1,11 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Linq; using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration.Events; using NzbDrone.Core.Download; -using NzbDrone.Core.Download.Clients.Nzbget; -using NzbDrone.Core.Download.Clients.Sabnzbd; using NzbDrone.Core.ThingiProvider.Events; namespace NzbDrone.Core.HealthCheck.Checks @@ -16,55 +11,14 @@ namespace NzbDrone.Core.HealthCheck.Checks public class ImportMechanismCheck : HealthCheckBase { private readonly IConfigService _configService; - private readonly IProvideDownloadClient _provideDownloadClient; - public ImportMechanismCheck(IConfigService configService, IProvideDownloadClient provideDownloadClient) + public ImportMechanismCheck(IConfigService configService) { _configService = configService; - _provideDownloadClient = provideDownloadClient; } public override HealthCheck Check() { - List downloadClients; - - try - { - downloadClients = _provideDownloadClient.GetDownloadClients().Select(v => new ImportMechanismCheckStatus - { - DownloadClient = v, - Status = v.GetStatus() - }).ToList(); - } - catch (Exception) - { - // One or more download clients failed, assume the health is okay and verify later - return new HealthCheck(GetType()); - } - - var downloadClientIsLocalHost = downloadClients.All(v => v.Status.IsLocalhost); - - if (!_configService.IsDefined("EnableCompletedDownloadHandling")) - { - // Migration helper logic - if (!downloadClientIsLocalHost) - { - return new HealthCheck(GetType(), HealthCheckResult.Warning, "Enable Completed Download Handling if possible (Multi-Computer unsupported)", "Migrating-to-Completed-Download-Handling#Unsupported-download-client-on-different-computer"); - } - - if (downloadClients.All(v => v.DownloadClient is Sabnzbd)) - { - return new HealthCheck(GetType(), HealthCheckResult.Warning, "Enable Completed Download Handling if possible (Sabnzbd)", "Migrating-to-Completed-Download-Handling#sabnzbd-enable-completed-download-handling"); - } - - if (downloadClients.All(v => v.DownloadClient is Nzbget)) - { - return new HealthCheck(GetType(), HealthCheckResult.Warning, "Enable Completed Download Handling if possible (Nzbget)", "Migrating-to-Completed-Download-Handling#nzbget-enable-completed-download-handling"); - } - - return new HealthCheck(GetType(), HealthCheckResult.Warning, "Enable Completed Download Handling if possible", "Migrating-to-Completed-Download-Handling"); - } - if (!_configService.EnableCompletedDownloadHandling) { return new HealthCheck(GetType(), HealthCheckResult.Warning, "Enable Completed Download Handling");