Show a series path as example in Mount Health Check

pull/7361/head
Bogdan 4 months ago committed by Mark McDowall
parent fb540040ef
commit 59f3be0813

@ -1,3 +1,4 @@
using System;
using System.Linq; using System.Linq;
using NzbDrone.Common.Disk; using NzbDrone.Common.Disk;
using NzbDrone.Core.Localization; using NzbDrone.Core.Localization;
@ -21,16 +22,16 @@ namespace NzbDrone.Core.HealthCheck.Checks
{ {
// Not best for optimization but due to possible symlinks and junctions, we get mounts based on series path so internals can handle mount resolution. // Not best for optimization but due to possible symlinks and junctions, we get mounts based on series path so internals can handle mount resolution.
var mounts = _seriesService.GetAllSeriesPaths() var mounts = _seriesService.GetAllSeriesPaths()
.Select(s => _diskProvider.GetMount(s.Value)) .Select(p => new Tuple<IMount, string>(_diskProvider.GetMount(p.Value), p.Value))
.Where(m => m is { MountOptions.IsReadOnly: true }) .Where(m => m.Item1 is { MountOptions.IsReadOnly: true })
.DistinctBy(m => m.RootDirectory) .DistinctBy(m => m.Item1.RootDirectory)
.ToList(); .ToList();
if (mounts.Any()) if (mounts.Any())
{ {
return new HealthCheck(GetType(), return new HealthCheck(GetType(),
HealthCheckResult.Error, HealthCheckResult.Error,
$"{_localizationService.GetLocalizedString("MountSeriesHealthCheckMessage")}{string.Join(", ", mounts.Select(m => m.Name))}", $"{_localizationService.GetLocalizedString("MountSeriesHealthCheckMessage")}{string.Join(", ", mounts.Select(m => $"{m.Item1.Name} ({m.Item2})"))}",
"#series-mount-ro"); "#series-mount-ro");
} }

Loading…
Cancel
Save