mirror of
https://github.com/Radarr/Radarr.git
synced 2024-09-11 12:02:35 +02:00
New: Translations support for Health Checks
This commit is contained in:
parent
200c7487b9
commit
bfc0361784
@ -1,6 +1,8 @@
|
||||
using NUnit.Framework;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common.EnvironmentInfo;
|
||||
using NzbDrone.Core.HealthCheck.Checks;
|
||||
using NzbDrone.Core.Localization;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Test.Common;
|
||||
|
||||
@ -9,6 +11,14 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
|
||||
[TestFixture]
|
||||
public class AppDataLocationFixture : CoreTest<AppDataLocationCheck>
|
||||
{
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
Mocker.GetMock<ILocalizationService>()
|
||||
.Setup(s => s.GetLocalizedString(It.IsAny<string>()))
|
||||
.Returns("Some Warning Message");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_warning_when_app_data_is_child_of_startup_folder()
|
||||
{
|
||||
|
@ -1,7 +1,9 @@
|
||||
using System;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common.EnvironmentInfo;
|
||||
using NzbDrone.Core.HealthCheck.Checks;
|
||||
using NzbDrone.Core.Localization;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test.HealthCheck.Checks
|
||||
@ -9,6 +11,14 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
|
||||
[TestFixture]
|
||||
public class DotnetVersionCheckFixture : CoreTest<DotnetVersionCheck>
|
||||
{
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
Mocker.GetMock<ILocalizationService>()
|
||||
.Setup(s => s.GetLocalizedString(It.IsAny<string>()))
|
||||
.Returns("Some Warning Message");
|
||||
}
|
||||
|
||||
private void GivenOutput(string version)
|
||||
{
|
||||
WindowsOnly();
|
||||
|
@ -1,8 +1,10 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.HealthCheck.Checks;
|
||||
using NzbDrone.Core.Localization;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test.HealthCheck.Checks
|
||||
@ -10,6 +12,14 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
|
||||
[TestFixture]
|
||||
public class DownloadClientCheckFixture : CoreTest<DownloadClientCheck>
|
||||
{
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
Mocker.GetMock<ILocalizationService>()
|
||||
.Setup(s => s.GetLocalizedString(It.IsAny<string>()))
|
||||
.Returns("Some Warning Message");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_warning_when_download_client_has_not_been_configured()
|
||||
{
|
||||
|
@ -1,6 +1,8 @@
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.HealthCheck.Checks;
|
||||
using NzbDrone.Core.Localization;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test.HealthCheck.Checks
|
||||
@ -8,6 +10,14 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
|
||||
[TestFixture]
|
||||
public class ImportMechanismCheckFixture : CoreTest<ImportMechanismCheck>
|
||||
{
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
Mocker.GetMock<ILocalizationService>()
|
||||
.Setup(s => s.GetLocalizedString(It.IsAny<string>()))
|
||||
.Returns("Some Warning Message");
|
||||
}
|
||||
|
||||
private void GivenCompletedDownloadHandling(bool? enabled = null)
|
||||
{
|
||||
if (enabled.HasValue)
|
||||
|
@ -1,8 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.HealthCheck.Checks;
|
||||
using NzbDrone.Core.Indexers;
|
||||
using NzbDrone.Core.Localization;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test.HealthCheck.Checks
|
||||
@ -22,6 +23,10 @@ public void SetUp()
|
||||
Mocker.GetMock<IIndexerFactory>()
|
||||
.Setup(s => s.RssEnabled(It.IsAny<bool>()))
|
||||
.Returns(new List<IIndexer>());
|
||||
|
||||
Mocker.GetMock<ILocalizationService>()
|
||||
.Setup(s => s.GetLocalizedString(It.IsAny<string>()))
|
||||
.Returns("Some Warning Message");
|
||||
}
|
||||
|
||||
private void GivenIndexer(bool supportsRss, bool supportsSearch)
|
||||
@ -47,6 +52,10 @@ private void GivenRssFiltered()
|
||||
Mocker.GetMock<IIndexerFactory>()
|
||||
.Setup(s => s.RssEnabled(false))
|
||||
.Returns(new List<IIndexer> { _indexerMock.Object });
|
||||
|
||||
Mocker.GetMock<ILocalizationService>()
|
||||
.Setup(s => s.GetLocalizedString(It.IsAny<string>()))
|
||||
.Returns("recent indexer errors");
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -1,8 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.HealthCheck.Checks;
|
||||
using NzbDrone.Core.Indexers;
|
||||
using NzbDrone.Core.Localization;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test.HealthCheck.Checks
|
||||
@ -26,6 +27,10 @@ public void SetUp()
|
||||
Mocker.GetMock<IIndexerFactory>()
|
||||
.Setup(s => s.InteractiveSearchEnabled(It.IsAny<bool>()))
|
||||
.Returns(new List<IIndexer>());
|
||||
|
||||
Mocker.GetMock<ILocalizationService>()
|
||||
.Setup(s => s.GetLocalizedString(It.IsAny<string>()))
|
||||
.Returns("Some Warning Message");
|
||||
}
|
||||
|
||||
private void GivenIndexer(bool supportsRss, bool supportsSearch)
|
||||
@ -62,6 +67,10 @@ private void GivenSearchFiltered()
|
||||
Mocker.GetMock<IIndexerFactory>()
|
||||
.Setup(s => s.InteractiveSearchEnabled(false))
|
||||
.Returns(new List<IIndexer> { _indexerMock.Object });
|
||||
|
||||
Mocker.GetMock<ILocalizationService>()
|
||||
.Setup(s => s.GetLocalizedString(It.IsAny<string>()))
|
||||
.Returns("recent indexer errors");
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -4,6 +4,7 @@
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.HealthCheck.Checks;
|
||||
using NzbDrone.Core.Indexers;
|
||||
using NzbDrone.Core.Localization;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test.HealthCheck.Checks
|
||||
@ -24,6 +25,10 @@ public void SetUp()
|
||||
Mocker.GetMock<IIndexerStatusService>()
|
||||
.Setup(v => v.GetBlockedProviders())
|
||||
.Returns(_blockedIndexers);
|
||||
|
||||
Mocker.GetMock<ILocalizationService>()
|
||||
.Setup(s => s.GetLocalizedString(It.IsAny<string>()))
|
||||
.Returns("Some Warning Message");
|
||||
}
|
||||
|
||||
private Mock<IIndexer> GivenIndexer(int i, double backoffHours, double failureHours)
|
||||
|
@ -1,7 +1,9 @@
|
||||
using System;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common.EnvironmentInfo;
|
||||
using NzbDrone.Core.HealthCheck.Checks;
|
||||
using NzbDrone.Core.Localization;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test.HealthCheck.Checks
|
||||
@ -9,6 +11,14 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
|
||||
[TestFixture]
|
||||
public class MonoVersionCheckFixture : CoreTest<MonoVersionCheck>
|
||||
{
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
Mocker.GetMock<ILocalizationService>()
|
||||
.Setup(s => s.GetLocalizedString(It.IsAny<string>()))
|
||||
.Returns("Some Warning Message");
|
||||
}
|
||||
|
||||
private void GivenOutput(string version)
|
||||
{
|
||||
MonoOnly();
|
||||
|
@ -3,6 +3,7 @@
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.HealthCheck.Checks;
|
||||
using NzbDrone.Core.Localization;
|
||||
using NzbDrone.Core.NetImport;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
@ -24,6 +25,10 @@ public void SetUp()
|
||||
Mocker.GetMock<INetImportStatusService>()
|
||||
.Setup(v => v.GetBlockedProviders())
|
||||
.Returns(_blockedLists);
|
||||
|
||||
Mocker.GetMock<ILocalizationService>()
|
||||
.Setup(s => s.GetLocalizedString(It.IsAny<string>()))
|
||||
.Returns("Some Warning Message");
|
||||
}
|
||||
|
||||
private Mock<INetImport> GivenList(int i, double backoffHours, double failureHours)
|
||||
|
@ -1,6 +1,8 @@
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.HealthCheck.Checks;
|
||||
using NzbDrone.Core.Localization;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test.HealthCheck.Checks
|
||||
@ -8,6 +10,14 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
|
||||
[TestFixture]
|
||||
public class ReleaseBranchCheckFixture : CoreTest<ReleaseBranchCheck>
|
||||
{
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
Mocker.GetMock<ILocalizationService>()
|
||||
.Setup(s => s.GetLocalizedString(It.IsAny<string>()))
|
||||
.Returns("Some Warning Message");
|
||||
}
|
||||
|
||||
private void GivenValidBranch(string branch)
|
||||
{
|
||||
Mocker.GetMock<IConfigFileProvider>()
|
||||
|
@ -1,15 +1,25 @@
|
||||
using System.Collections.Generic;
|
||||
using FizzWare.NBuilder;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.HealthCheck.Checks;
|
||||
using NzbDrone.Core.Localization;
|
||||
using NzbDrone.Core.Movies;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test.HealthCheck.Checks
|
||||
{
|
||||
[TestFixture]
|
||||
public class RemovedSeriesCheckFixture : CoreTest<RemovedSeriesCheck>
|
||||
public class RemovedMovieCheckFixture : CoreTest<RemovedMovieCheck>
|
||||
{
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
Mocker.GetMock<ILocalizationService>()
|
||||
.Setup(s => s.GetLocalizedString(It.IsAny<string>()))
|
||||
.Returns("Some Warning Message");
|
||||
}
|
||||
|
||||
private void GivenMovie(int amount, int deleted)
|
||||
{
|
||||
List<Movie> movie;
|
||||
|
@ -5,6 +5,7 @@
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common.Disk;
|
||||
using NzbDrone.Core.HealthCheck.Checks;
|
||||
using NzbDrone.Core.Localization;
|
||||
using NzbDrone.Core.Movies;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
@ -13,6 +14,14 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
|
||||
[TestFixture]
|
||||
public class RootFolderCheckFixture : CoreTest<RootFolderCheck>
|
||||
{
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
Mocker.GetMock<ILocalizationService>()
|
||||
.Setup(s => s.GetLocalizedString(It.IsAny<string>()))
|
||||
.Returns("Some Warning Message");
|
||||
}
|
||||
|
||||
private void GivenMissingRootFolder()
|
||||
{
|
||||
var movies = Builder<Movie>.CreateListOfSize(1)
|
||||
|
@ -1,9 +1,10 @@
|
||||
using Moq;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common.Disk;
|
||||
using NzbDrone.Common.EnvironmentInfo;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.HealthCheck.Checks;
|
||||
using NzbDrone.Core.Localization;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Core.Update;
|
||||
|
||||
@ -12,6 +13,14 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
|
||||
[TestFixture]
|
||||
public class UpdateCheckFixture : CoreTest<UpdateCheck>
|
||||
{
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
Mocker.GetMock<ILocalizationService>()
|
||||
.Setup(s => s.GetLocalizedString(It.IsAny<string>()))
|
||||
.Returns("Some Warning Message");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_error_when_app_folder_is_write_protected()
|
||||
{
|
||||
|
@ -1,5 +1,6 @@
|
||||
using NzbDrone.Common.EnvironmentInfo;
|
||||
using NzbDrone.Common.EnvironmentInfo;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Localization;
|
||||
|
||||
namespace NzbDrone.Core.HealthCheck.Checks
|
||||
{
|
||||
@ -7,7 +8,8 @@ public class AppDataLocationCheck : HealthCheckBase
|
||||
{
|
||||
private readonly IAppFolderInfo _appFolderInfo;
|
||||
|
||||
public AppDataLocationCheck(IAppFolderInfo appFolderInfo)
|
||||
public AppDataLocationCheck(IAppFolderInfo appFolderInfo, ILocalizationService localizationService)
|
||||
: base(localizationService)
|
||||
{
|
||||
_appFolderInfo = appFolderInfo;
|
||||
}
|
||||
@ -17,7 +19,7 @@ public override HealthCheck Check()
|
||||
if (_appFolderInfo.StartUpFolder.IsParentPath(_appFolderInfo.AppDataFolder) ||
|
||||
_appFolderInfo.StartUpFolder.PathEquals(_appFolderInfo.AppDataFolder))
|
||||
{
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Warning, "Updating will not be possible to prevent deleting AppData on Update");
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("AppDataLocationHealthCheckMessage"));
|
||||
}
|
||||
|
||||
return new HealthCheck(GetType());
|
||||
|
@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System;
|
||||
using NLog;
|
||||
using NzbDrone.Common.EnvironmentInfo;
|
||||
using NzbDrone.Core.Localization;
|
||||
|
||||
namespace NzbDrone.Core.HealthCheck.Checks
|
||||
{
|
||||
@ -10,7 +11,8 @@ public class DotnetVersionCheck : HealthCheckBase
|
||||
private readonly IOsInfo _osInfo;
|
||||
private readonly Logger _logger;
|
||||
|
||||
public DotnetVersionCheck(IPlatformInfo platformInfo, IOsInfo osInfo, Logger logger)
|
||||
public DotnetVersionCheck(IPlatformInfo platformInfo, IOsInfo osInfo, ILocalizationService localizationService, Logger logger)
|
||||
: base(localizationService)
|
||||
{
|
||||
_platformInfo = platformInfo;
|
||||
_osInfo = osInfo;
|
||||
@ -47,13 +49,13 @@ public override HealthCheck Check()
|
||||
_logger.Debug("Dotnet version is {0} or better: {1}", stableVersion, dotnetVersion);
|
||||
return new HealthCheck(GetType(),
|
||||
HealthCheckResult.Notice,
|
||||
$"Currently installed .Net Framework {dotnetVersion} is supported but we recommend upgrading to at least {targetVersion}.",
|
||||
string.Format(_localizationService.GetLocalizedString("DotNetVersionCheckNotRecommendedMessage"), dotnetVersion, targetVersion),
|
||||
"#currently-installed-net-framework-is-supported-but-upgrading-is-recommended");
|
||||
}
|
||||
|
||||
return new HealthCheck(GetType(),
|
||||
HealthCheckResult.Error,
|
||||
$"Currently installed .Net Framework {dotnetVersion} is old and unsupported. Please upgrade the .Net Framework to at least {targetVersion}.",
|
||||
string.Format(_localizationService.GetLocalizedString("DotNetVersionCheckOldUnsupportedMessage"), dotnetVersion, targetVersion),
|
||||
"#currently-installed-net-framework-is-old-and-unsupported");
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.Localization;
|
||||
using NzbDrone.Core.ThingiProvider.Events;
|
||||
|
||||
namespace NzbDrone.Core.HealthCheck.Checks
|
||||
@ -15,7 +16,8 @@ public class DownloadClientCheck : HealthCheckBase
|
||||
private readonly IProvideDownloadClient _downloadClientProvider;
|
||||
private readonly Logger _logger;
|
||||
|
||||
public DownloadClientCheck(IProvideDownloadClient downloadClientProvider, Logger logger)
|
||||
public DownloadClientCheck(IProvideDownloadClient downloadClientProvider, ILocalizationService localizationService, Logger logger)
|
||||
: base(localizationService)
|
||||
{
|
||||
_downloadClientProvider = downloadClientProvider;
|
||||
_logger = logger;
|
||||
@ -27,7 +29,7 @@ public override HealthCheck Check()
|
||||
|
||||
if (!downloadClients.Any())
|
||||
{
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Warning, "No download client is available");
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("DownloadClientCheckNoneAvailableMessage"));
|
||||
}
|
||||
|
||||
foreach (var downloadClient in downloadClients)
|
||||
@ -40,7 +42,7 @@ public override HealthCheck Check()
|
||||
{
|
||||
_logger.Debug(ex, "Unable to communicate with {0}", downloadClient.Definition.Name);
|
||||
|
||||
var message = $"Unable to communicate with {downloadClient.Definition.Name}.";
|
||||
var message = string.Format(_localizationService.GetLocalizedString("DownloadClientCheckUnableToCommunicateMessage"), downloadClient.Definition.Name);
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Error, $"{message} {ex.Message}", "#unable-to-communicate-with-download-client");
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
using System.Linq;
|
||||
using System.Linq;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.Localization;
|
||||
using NzbDrone.Core.ThingiProvider.Events;
|
||||
|
||||
namespace NzbDrone.Core.HealthCheck.Checks
|
||||
@ -13,7 +14,8 @@ public class DownloadClientStatusCheck : HealthCheckBase
|
||||
private readonly IDownloadClientFactory _providerFactory;
|
||||
private readonly IDownloadClientStatusService _providerStatusService;
|
||||
|
||||
public DownloadClientStatusCheck(IDownloadClientFactory providerFactory, IDownloadClientStatusService providerStatusService)
|
||||
public DownloadClientStatusCheck(IDownloadClientFactory providerFactory, IDownloadClientStatusService providerStatusService, ILocalizationService localizationService)
|
||||
: base(localizationService)
|
||||
{
|
||||
_providerFactory = providerFactory;
|
||||
_providerStatusService = providerStatusService;
|
||||
@ -35,10 +37,10 @@ public override HealthCheck Check()
|
||||
|
||||
if (backOffProviders.Count == enabledProviders.Count)
|
||||
{
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Error, "All download clients are unavailable due to failures", "#download-clients-are-unavailable-due-to-failures");
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Error, _localizationService.GetLocalizedString("DownloadClientStatusCheckAllClientMessage"), "#download-clients-are-unavailable-due-to-failures");
|
||||
}
|
||||
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Warning, string.Format("Download clients unavailable due to failures: {0}", string.Join(", ", backOffProviders.Select(v => v.Provider.Definition.Name))), "#download-clients-are-unavailable-due-to-failures");
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Warning, string.Format(_localizationService.GetLocalizedString("DownloadClientStatusCheckSingleClientMessage"), string.Join(", ", backOffProviders.Select(v => v.Provider.Definition.Name))), "#download-clients-are-unavailable-due-to-failures");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Configuration.Events;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.Localization;
|
||||
using NzbDrone.Core.ThingiProvider.Events;
|
||||
|
||||
namespace NzbDrone.Core.HealthCheck.Checks
|
||||
@ -12,7 +13,8 @@ public class ImportMechanismCheck : HealthCheckBase
|
||||
{
|
||||
private readonly IConfigService _configService;
|
||||
|
||||
public ImportMechanismCheck(IConfigService configService)
|
||||
public ImportMechanismCheck(IConfigService configService, ILocalizationService localizationService)
|
||||
: base(localizationService)
|
||||
{
|
||||
_configService = configService;
|
||||
}
|
||||
@ -21,7 +23,7 @@ public override HealthCheck Check()
|
||||
{
|
||||
if (!_configService.EnableCompletedDownloadHandling)
|
||||
{
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Warning, "Enable Completed Download Handling");
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("ImportMechanismHealthCheckMessage"));
|
||||
}
|
||||
|
||||
return new HealthCheck(GetType());
|
||||
|
@ -1,5 +1,6 @@
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Indexers;
|
||||
using NzbDrone.Core.Localization;
|
||||
using NzbDrone.Core.ThingiProvider.Events;
|
||||
|
||||
namespace NzbDrone.Core.HealthCheck.Checks
|
||||
@ -12,7 +13,8 @@ public class IndexerRssCheck : HealthCheckBase
|
||||
{
|
||||
private readonly IIndexerFactory _indexerFactory;
|
||||
|
||||
public IndexerRssCheck(IIndexerFactory indexerFactory)
|
||||
public IndexerRssCheck(IIndexerFactory indexerFactory, ILocalizationService localizationService)
|
||||
: base(localizationService)
|
||||
{
|
||||
_indexerFactory = indexerFactory;
|
||||
}
|
||||
@ -23,14 +25,14 @@ public override HealthCheck Check()
|
||||
|
||||
if (enabled.Empty())
|
||||
{
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Error, "No indexers available with RSS sync enabled, Radarr will not grab new releases automatically");
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Error, _localizationService.GetLocalizedString("IndexerRssHealthCheckNoIndexers"));
|
||||
}
|
||||
|
||||
var active = _indexerFactory.RssEnabled(true);
|
||||
|
||||
if (active.Empty())
|
||||
{
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Warning, "All rss-capable indexers are temporarily unavailable due to recent indexer errors");
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("IndexerRssHealthCheckNoAvailableIndexers"));
|
||||
}
|
||||
|
||||
return new HealthCheck(GetType());
|
||||
|
@ -1,5 +1,6 @@
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Indexers;
|
||||
using NzbDrone.Core.Localization;
|
||||
using NzbDrone.Core.ThingiProvider.Events;
|
||||
|
||||
namespace NzbDrone.Core.HealthCheck.Checks
|
||||
@ -12,7 +13,8 @@ public class IndexerSearchCheck : HealthCheckBase
|
||||
{
|
||||
private readonly IIndexerFactory _indexerFactory;
|
||||
|
||||
public IndexerSearchCheck(IIndexerFactory indexerFactory)
|
||||
public IndexerSearchCheck(IIndexerFactory indexerFactory, ILocalizationService localizationService)
|
||||
: base(localizationService)
|
||||
{
|
||||
_indexerFactory = indexerFactory;
|
||||
}
|
||||
@ -23,21 +25,21 @@ public override HealthCheck Check()
|
||||
|
||||
if (automaticSearchEnabled.Empty())
|
||||
{
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Warning, "No indexers available with Automatic Search enabled, Radarr will not provide any automatic search results");
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("IndexerSearchCheckNoAutomaticMessage"));
|
||||
}
|
||||
|
||||
var interactiveSearchEnabled = _indexerFactory.InteractiveSearchEnabled(false);
|
||||
|
||||
if (interactiveSearchEnabled.Empty())
|
||||
{
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Warning, "No indexers available with Interactive Search enabled, Radarr will not provide any interactive search results");
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("IndexerSearchCheckNoInteractiveMessage"));
|
||||
}
|
||||
|
||||
var active = _indexerFactory.AutomaticSearchEnabled(true);
|
||||
|
||||
if (active.Empty())
|
||||
{
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Warning, "All search-capable indexers are temporarily unavailable due to recent indexer errors");
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("IndexerSearchCheckNoAvailableIndexersMessage"));
|
||||
}
|
||||
|
||||
return new HealthCheck(GetType());
|
||||
|
@ -1,6 +1,7 @@
|
||||
using System.Linq;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Indexers;
|
||||
using NzbDrone.Core.Localization;
|
||||
using NzbDrone.Core.ThingiProvider.Events;
|
||||
|
||||
namespace NzbDrone.Core.HealthCheck.Checks
|
||||
@ -13,7 +14,8 @@ public class IndexerStatusCheck : HealthCheckBase
|
||||
private readonly IIndexerFactory _providerFactory;
|
||||
private readonly IIndexerStatusService _providerStatusService;
|
||||
|
||||
public IndexerStatusCheck(IIndexerFactory providerFactory, IIndexerStatusService providerStatusService)
|
||||
public IndexerStatusCheck(IIndexerFactory providerFactory, IIndexerStatusService providerStatusService, ILocalizationService localizationService)
|
||||
: base(localizationService)
|
||||
{
|
||||
_providerFactory = providerFactory;
|
||||
_providerStatusService = providerStatusService;
|
||||
@ -35,10 +37,10 @@ public override HealthCheck Check()
|
||||
|
||||
if (backOffProviders.Count == enabledProviders.Count)
|
||||
{
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Error, "All indexers are unavailable due to failures", "#indexers-are-unavailable-due-to-failures");
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Error, _localizationService.GetLocalizedString("IndexerStatusCheckAllClientMessage"), "#indexers-are-unavailable-due-to-failures");
|
||||
}
|
||||
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Warning, string.Format("Indexers unavailable due to failures: {0}", string.Join(", ", backOffProviders.Select(v => v.Provider.Definition.Name))), "#indexers-are-unavailable-due-to-failures");
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Warning, string.Format(_localizationService.GetLocalizedString("IndexerStatusCheckSingleClientMessage"), string.Join(", ", backOffProviders.Select(v => v.Provider.Definition.Name))), "#indexers-are-unavailable-due-to-failures");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,17 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using NzbDrone.Core.Localization;
|
||||
using NzbDrone.Core.MediaFiles.MediaInfo;
|
||||
|
||||
namespace NzbDrone.Core.HealthCheck.Checks
|
||||
{
|
||||
public class MediaInfoDllCheck : HealthCheckBase
|
||||
{
|
||||
public MediaInfoDllCheck(ILocalizationService localizationService)
|
||||
: base(localizationService)
|
||||
{
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.NoOptimization)]
|
||||
public override HealthCheck Check()
|
||||
{
|
||||
@ -15,7 +21,7 @@ public override HealthCheck Check()
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Warning, $"MediaInfo Library could not be loaded {e.Message}");
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Warning, string.Format(_localizationService.GetLocalizedString("MediaInfoDllCheckMessage"), e.Message));
|
||||
}
|
||||
|
||||
return new HealthCheck(GetType());
|
||||
|
@ -1,7 +1,8 @@
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics;
|
||||
using NLog;
|
||||
using NzbDrone.Common.EnvironmentInfo;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Localization;
|
||||
|
||||
namespace NzbDrone.Core.HealthCheck.Checks
|
||||
{
|
||||
@ -12,7 +13,8 @@ public class MonoDebugCheck : HealthCheckBase
|
||||
|
||||
public override bool CheckOnSchedule => false;
|
||||
|
||||
public MonoDebugCheck(Logger logger, StackFrameHelper stackFrameHelper)
|
||||
public MonoDebugCheck(Logger logger, StackFrameHelper stackFrameHelper, ILocalizationService localizationService)
|
||||
: base(localizationService)
|
||||
{
|
||||
_logger = logger;
|
||||
_stackFrameHelper = stackFrameHelper;
|
||||
|
@ -1,8 +1,9 @@
|
||||
using System.Linq;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using NLog;
|
||||
using NzbDrone.Common.EnvironmentInfo;
|
||||
using NzbDrone.Common.Processes;
|
||||
using NzbDrone.Core.Localization;
|
||||
|
||||
namespace NzbDrone.Core.HealthCheck.Checks
|
||||
{
|
||||
@ -14,7 +15,9 @@ public class MonoNotNetCoreCheck : HealthCheckBase
|
||||
|
||||
public MonoNotNetCoreCheck(IOsInfo osInfo,
|
||||
IProcessProvider processProvider,
|
||||
ILocalizationService localizationService,
|
||||
Logger logger)
|
||||
: base(localizationService)
|
||||
{
|
||||
_osInfo = osInfo;
|
||||
_processProvider = processProvider;
|
||||
@ -42,7 +45,7 @@ public override HealthCheck Check()
|
||||
|
||||
return new HealthCheck(GetType(),
|
||||
HealthCheckResult.Warning,
|
||||
"Please upgrade to the .NET Core version of Radarr",
|
||||
_localizationService.GetLocalizedString("MonoNotNetCoreCheckMessage"),
|
||||
"#update-to-net-core-version");
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,9 @@
|
||||
using System;
|
||||
using System;
|
||||
using NLog;
|
||||
using NLog.Fluent;
|
||||
using NzbDrone.Common.EnvironmentInfo;
|
||||
using NzbDrone.Common.Instrumentation.Extensions;
|
||||
using NzbDrone.Core.Localization;
|
||||
|
||||
namespace NzbDrone.Core.HealthCheck.Checks
|
||||
{
|
||||
@ -11,7 +12,8 @@ public class MonoTlsCheck : HealthCheckBase
|
||||
private readonly IPlatformInfo _platformInfo;
|
||||
private readonly Logger _logger;
|
||||
|
||||
public MonoTlsCheck(IPlatformInfo platformInfo, Logger logger)
|
||||
public MonoTlsCheck(IPlatformInfo platformInfo, ILocalizationService localizationService, Logger logger)
|
||||
: base(localizationService)
|
||||
{
|
||||
_platformInfo = platformInfo;
|
||||
_logger = logger;
|
||||
@ -33,7 +35,7 @@ public override HealthCheck Check()
|
||||
.WriteSentryDebug("LegacyTlsProvider", monoVersion.ToString())
|
||||
.Write();
|
||||
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Warning, "Sonarr Mono 4.x tls workaround still enabled, consider removing MONO_TLS_PROVIDER=legacy environment option");
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("MonoTlsCheckMessage"));
|
||||
}
|
||||
|
||||
return new HealthCheck(GetType());
|
||||
|
@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using NLog;
|
||||
using NzbDrone.Common.EnvironmentInfo;
|
||||
using NzbDrone.Core.Localization;
|
||||
|
||||
namespace NzbDrone.Core.HealthCheck.Checks
|
||||
{
|
||||
@ -9,7 +10,8 @@ public class MonoVersionCheck : HealthCheckBase
|
||||
private readonly IPlatformInfo _platformInfo;
|
||||
private readonly Logger _logger;
|
||||
|
||||
public MonoVersionCheck(IPlatformInfo platformInfo, Logger logger)
|
||||
public MonoVersionCheck(IPlatformInfo platformInfo, ILocalizationService localizationService, Logger logger)
|
||||
: base(localizationService)
|
||||
{
|
||||
_platformInfo = platformInfo;
|
||||
_logger = logger;
|
||||
|
@ -1,6 +1,7 @@
|
||||
using System.Linq;
|
||||
using NzbDrone.Common.Disk;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Localization;
|
||||
using NzbDrone.Core.Movies;
|
||||
|
||||
namespace NzbDrone.Core.HealthCheck.Checks
|
||||
@ -10,7 +11,8 @@ public class MountCheck : HealthCheckBase
|
||||
private readonly IDiskProvider _diskProvider;
|
||||
private readonly IMovieService _movieService;
|
||||
|
||||
public MountCheck(IDiskProvider diskProvider, IMovieService movieService)
|
||||
public MountCheck(IDiskProvider diskProvider, IMovieService movieService, ILocalizationService localizationService)
|
||||
: base(localizationService)
|
||||
{
|
||||
_diskProvider = diskProvider;
|
||||
_movieService = movieService;
|
||||
@ -27,7 +29,7 @@ public override HealthCheck Check()
|
||||
|
||||
if (mounts.Any())
|
||||
{
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Error, "Mount containing a movie path is mounted read-only: " + string.Join(",", mounts.Select(m => m.Name)), "#movie-mount-ro");
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Error, _localizationService.GetLocalizedString("MountCheckMessage") + string.Join(", ", mounts.Select(m => m.Name)), "#movie-mount-ro");
|
||||
}
|
||||
|
||||
return new HealthCheck(GetType());
|
||||
|
@ -1,5 +1,6 @@
|
||||
using System.Linq;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Localization;
|
||||
using NzbDrone.Core.NetImport;
|
||||
using NzbDrone.Core.ThingiProvider.Events;
|
||||
|
||||
@ -13,7 +14,8 @@ public class NetImportStatusCheck : HealthCheckBase
|
||||
private readonly INetImportFactory _providerFactory;
|
||||
private readonly INetImportStatusService _providerStatusService;
|
||||
|
||||
public NetImportStatusCheck(INetImportFactory providerFactory, INetImportStatusService providerStatusService)
|
||||
public NetImportStatusCheck(INetImportFactory providerFactory, INetImportStatusService providerStatusService, ILocalizationService localizationService)
|
||||
: base(localizationService)
|
||||
{
|
||||
_providerFactory = providerFactory;
|
||||
_providerStatusService = providerStatusService;
|
||||
@ -35,10 +37,10 @@ public override HealthCheck Check()
|
||||
|
||||
if (backOffProviders.Count == enabledProviders.Count)
|
||||
{
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Error, "All lists are unavailable due to failures", "#lists-are-unavailable-due-to-failures");
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Error, _localizationService.GetLocalizedString("NetImportStatusCheckAllClientMessage"), "#lists-are-unavailable-due-to-failures");
|
||||
}
|
||||
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Warning, string.Format("Lists unavailable due to failures: {0}", string.Join(", ", backOffProviders.Select(v => v.Provider.Definition.Name))), "#lists-are-unavailable-due-to-failures");
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Warning, string.Format(_localizationService.GetLocalizedString("NetImportStatusCheckSingleClientMessage"), string.Join(", ", backOffProviders.Select(v => v.Provider.Definition.Name))), "#lists-are-unavailable-due-to-failures");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Indexers;
|
||||
using NzbDrone.Core.Indexers.PassThePopcorn;
|
||||
using NzbDrone.Core.Localization;
|
||||
|
||||
namespace NzbDrone.Core.HealthCheck.Checks
|
||||
{
|
||||
@ -9,7 +10,8 @@ public class PTPOldSettingsCheck : HealthCheckBase
|
||||
{
|
||||
private readonly IIndexerFactory _indexerFactory;
|
||||
|
||||
public PTPOldSettingsCheck(IIndexerFactory indexerFactory)
|
||||
public PTPOldSettingsCheck(IIndexerFactory indexerFactory, ILocalizationService localizationService)
|
||||
: base(localizationService)
|
||||
{
|
||||
_indexerFactory = indexerFactory;
|
||||
}
|
||||
@ -23,7 +25,7 @@ public override HealthCheck Check()
|
||||
|
||||
if (ptpIndexerOldSettings.Count() > 0)
|
||||
{
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Warning, $"The following PassThePopcorn indexers have deprecated settings and should be updated: {string.Join(",", ptpIndexerOldSettings)}");
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Warning, string.Format(_localizationService.GetLocalizedString("PtpOldSettingsCheckMessage"), string.Join(", ", ptpIndexerOldSettings)));
|
||||
}
|
||||
|
||||
return new HealthCheck(GetType());
|
||||
|
@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using NLog;
|
||||
@ -6,6 +6,7 @@
|
||||
using NzbDrone.Common.Http;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Configuration.Events;
|
||||
using NzbDrone.Core.Localization;
|
||||
|
||||
namespace NzbDrone.Core.HealthCheck.Checks
|
||||
{
|
||||
@ -18,7 +19,8 @@ public class ProxyCheck : HealthCheckBase
|
||||
|
||||
private readonly IHttpRequestBuilderFactory _cloudRequestBuilder;
|
||||
|
||||
public ProxyCheck(IRadarrCloudRequestBuilder cloudRequestBuilder, IConfigService configService, IHttpClient client, Logger logger)
|
||||
public ProxyCheck(IRadarrCloudRequestBuilder cloudRequestBuilder, IConfigService configService, IHttpClient client, ILocalizationService localizationService, Logger logger)
|
||||
: base(localizationService)
|
||||
{
|
||||
_configService = configService;
|
||||
_client = client;
|
||||
@ -34,7 +36,7 @@ public override HealthCheck Check()
|
||||
var addresses = Dns.GetHostAddresses(_configService.ProxyHostname);
|
||||
if (!addresses.Any())
|
||||
{
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format("Failed to resolve the IP Address for the Configured Proxy Host {0}", _configService.ProxyHostname));
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("ProxyCheckResolveIpMessage"), _configService.ProxyHostname));
|
||||
}
|
||||
|
||||
var request = _cloudRequestBuilder.Create()
|
||||
@ -49,13 +51,13 @@ public override HealthCheck Check()
|
||||
if (response.StatusCode == HttpStatusCode.BadRequest)
|
||||
{
|
||||
_logger.Error("Proxy Health Check failed: {0}", response.StatusCode);
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Error, $"Failed to test proxy. StatusCode: {response.StatusCode}");
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("ProxyCheckBadRequestMessage"), response.StatusCode));
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex, "Proxy Health Check failed");
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Error, $"Failed to test proxy: {request.Url}");
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("ProxyCheckFailedToTestMessage"), request.Url));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
using System.Linq;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Configuration.Events;
|
||||
using NzbDrone.Core.Localization;
|
||||
|
||||
namespace NzbDrone.Core.HealthCheck.Checks
|
||||
{
|
||||
@ -10,7 +11,8 @@ public class ReleaseBranchCheck : HealthCheckBase
|
||||
{
|
||||
private readonly IConfigFileProvider _configFileService;
|
||||
|
||||
public ReleaseBranchCheck(IConfigFileProvider configFileService)
|
||||
public ReleaseBranchCheck(IConfigFileProvider configFileService, ILocalizationService localizationService)
|
||||
: base(localizationService)
|
||||
{
|
||||
_configFileService = configFileService;
|
||||
}
|
||||
@ -23,10 +25,10 @@ public override HealthCheck Check()
|
||||
{
|
||||
if (currentBranch == "develop" || currentBranch == "nightly")
|
||||
{
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format("Branch {0} is for a previous version of Radarr, set branch to 'Aphrodite' for further updates", _configFileService.Branch), "#branch-is-for-a-previous-version");
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("ReleaseBranchCheckPreviousVersionMessage"), _configFileService.Branch), "#branch-is-for-a-previous-version");
|
||||
}
|
||||
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Warning, string.Format("Branch {0} is not a valid Radarr release branch, you will not receive updates", _configFileService.Branch), "#branch-is-not-a-valid-release-branch");
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Warning, string.Format(_localizationService.GetLocalizedString("ReleaseBranchCheckOfficialBranchMessage"), _configFileService.Branch), "#branch-is-not-a-valid-release-branch");
|
||||
}
|
||||
|
||||
return new HealthCheck(GetType());
|
||||
|
@ -8,6 +8,7 @@
|
||||
using NzbDrone.Core.Datastore.Events;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.Download.Clients;
|
||||
using NzbDrone.Core.Localization;
|
||||
using NzbDrone.Core.MediaFiles.Events;
|
||||
using NzbDrone.Core.RemotePathMappings;
|
||||
using NzbDrone.Core.ThingiProvider.Events;
|
||||
@ -30,7 +31,9 @@ public class RemotePathMappingCheck : HealthCheckBase, IProvideHealthCheck
|
||||
public RemotePathMappingCheck(IDiskProvider diskProvider,
|
||||
IProvideDownloadClient downloadClientProvider,
|
||||
IOsInfo osInfo,
|
||||
Logger logger)
|
||||
Logger logger,
|
||||
ILocalizationService localizationService)
|
||||
: base(localizationService)
|
||||
{
|
||||
_diskProvider = diskProvider;
|
||||
_downloadClientProvider = downloadClientProvider;
|
||||
|
@ -1,5 +1,6 @@
|
||||
using System.Linq;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Localization;
|
||||
using NzbDrone.Core.Movies;
|
||||
using NzbDrone.Core.Movies.Events;
|
||||
|
||||
@ -7,11 +8,12 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||
{
|
||||
[CheckOn(typeof(MovieUpdatedEvent))]
|
||||
[CheckOn(typeof(MoviesDeletedEvent), CheckOnCondition.FailedOnly)]
|
||||
public class RemovedSeriesCheck : HealthCheckBase, ICheckOnCondition<MovieUpdatedEvent>, ICheckOnCondition<MoviesDeletedEvent>
|
||||
public class RemovedMovieCheck : HealthCheckBase, ICheckOnCondition<MovieUpdatedEvent>, ICheckOnCondition<MoviesDeletedEvent>
|
||||
{
|
||||
private readonly IMovieService _movieService;
|
||||
|
||||
public RemovedSeriesCheck(IMovieService movieService)
|
||||
public RemovedMovieCheck(IMovieService movieService, ILocalizationService localizationService)
|
||||
: base(localizationService)
|
||||
{
|
||||
_movieService = movieService;
|
||||
}
|
||||
@ -29,10 +31,10 @@ public override HealthCheck Check()
|
||||
|
||||
if (deletedMovie.Count == 1)
|
||||
{
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format("Movie {0} was removed from TMDb", movieText), "#movie-was-removed-from-tmdb");
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("RemovedMovieCheckSingleMessage"), movieText), "#movie-was-removed-from-tmdb");
|
||||
}
|
||||
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format("Movie {0} was removed from TMDb", movieText), "#movie-was-removed-from-tmdb");
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("RemovedMovieCheckMultipleMessage"), movieText), "#movie-was-removed-from-tmdb");
|
||||
}
|
||||
|
||||
public bool ShouldCheckOnEvent(MoviesDeletedEvent message)
|
||||
|
@ -1,5 +1,6 @@
|
||||
using System.Linq;
|
||||
using NzbDrone.Common.Disk;
|
||||
using NzbDrone.Core.Localization;
|
||||
using NzbDrone.Core.MediaFiles.Events;
|
||||
using NzbDrone.Core.Movies;
|
||||
using NzbDrone.Core.Movies.Events;
|
||||
@ -17,7 +18,8 @@ public class RootFolderCheck : HealthCheckBase
|
||||
private readonly IDiskProvider _diskProvider;
|
||||
private readonly IRootFolderService _rootFolderService;
|
||||
|
||||
public RootFolderCheck(IMovieService movieService, IDiskProvider diskProvider, IRootFolderService rootFolderService)
|
||||
public RootFolderCheck(IMovieService movieService, IDiskProvider diskProvider, IRootFolderService rootFolderService, ILocalizationService localizationService)
|
||||
: base(localizationService)
|
||||
{
|
||||
_movieService = movieService;
|
||||
_diskProvider = diskProvider;
|
||||
@ -37,10 +39,10 @@ public override HealthCheck Check()
|
||||
{
|
||||
if (missingRootFolders.Count == 1)
|
||||
{
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Error, "Missing root folder: " + missingRootFolders.First(), "#missing-root-folder");
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("RootFolderCheckSingleMessage"), missingRootFolders.First()), "#missing-root-folder");
|
||||
}
|
||||
|
||||
var message = string.Format("Multiple root folders are missing: {0}", string.Join(" | ", missingRootFolders));
|
||||
var message = string.Format(_localizationService.GetLocalizedString("RootFolderCheckMultipleMessage"), string.Join(" | ", missingRootFolders));
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Error, message, "#missing-root-folder");
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Configuration.Events;
|
||||
using NzbDrone.Core.Localization;
|
||||
using NzbDrone.Core.Update;
|
||||
|
||||
namespace NzbDrone.Core.HealthCheck.Checks
|
||||
@ -22,7 +23,9 @@ public UpdateCheck(IDiskProvider diskProvider,
|
||||
IAppFolderInfo appFolderInfo,
|
||||
ICheckUpdateService checkUpdateService,
|
||||
IConfigFileProvider configFileProvider,
|
||||
IOsInfo osInfo)
|
||||
IOsInfo osInfo,
|
||||
ILocalizationService localizationService)
|
||||
: base(localizationService)
|
||||
{
|
||||
_diskProvider = diskProvider;
|
||||
_appFolderInfo = appFolderInfo;
|
||||
@ -44,7 +47,7 @@ public override HealthCheck Check()
|
||||
{
|
||||
return new HealthCheck(GetType(),
|
||||
HealthCheckResult.Error,
|
||||
string.Format("Cannot install update because startup folder '{0}' is in an App Translocation folder.", startupFolder),
|
||||
string.Format(_localizationService.GetLocalizedString("UpdateCheckStartupTranslocationMessage"), startupFolder),
|
||||
"#cannot-install-update-because-startup-folder-is-in-an-app-translocation-folder.");
|
||||
}
|
||||
|
||||
@ -52,7 +55,7 @@ public override HealthCheck Check()
|
||||
{
|
||||
return new HealthCheck(GetType(),
|
||||
HealthCheckResult.Error,
|
||||
string.Format("Cannot install update because startup folder '{0}' is not writable by the user '{1}'.", startupFolder, Environment.UserName),
|
||||
string.Format(_localizationService.GetLocalizedString("UpdateCheckStartupNotWritableMessage"), startupFolder, Environment.UserName),
|
||||
"#cannot-install-update-because-startup-folder-is-not-writable-by-the-user");
|
||||
}
|
||||
|
||||
@ -60,7 +63,7 @@ public override HealthCheck Check()
|
||||
{
|
||||
return new HealthCheck(GetType(),
|
||||
HealthCheckResult.Error,
|
||||
string.Format("Cannot install update because UI folder '{0}' is not writable by the user '{1}'.", uiFolder, Environment.UserName),
|
||||
string.Format(_localizationService.GetLocalizedString("UpdateCheckUINotWritableMessage"), uiFolder, Environment.UserName),
|
||||
"#cannot-install-update-because-ui-folder-is-not-writable-by-the-user");
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,15 @@
|
||||
namespace NzbDrone.Core.HealthCheck
|
||||
using NzbDrone.Core.Localization;
|
||||
|
||||
namespace NzbDrone.Core.HealthCheck
|
||||
{
|
||||
public abstract class HealthCheckBase : IProvideHealthCheck
|
||||
{
|
||||
public readonly ILocalizationService _localizationService;
|
||||
public HealthCheckBase(ILocalizationService localizationService)
|
||||
{
|
||||
_localizationService = localizationService;
|
||||
}
|
||||
|
||||
public abstract HealthCheck Check();
|
||||
|
||||
public virtual bool CheckOnStartup => true;
|
||||
|
Loading…
Reference in New Issue
Block a user