You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Radarr/src/NzbDrone.Core/HealthCheck/Checks/ReleaseBranchCheck.cs

41 lines
1.4 KiB

using System;
using System.Linq;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.Configuration.Events;
namespace NzbDrone.Core.HealthCheck.Checks
{
[CheckOn(typeof(ConfigSavedEvent))]
public class ReleaseBranchCheck : HealthCheckBase
{
private readonly IConfigFileProvider _configFileService;
public ReleaseBranchCheck(IConfigFileProvider configFileService)
{
_configFileService = configFileService;
}
public override HealthCheck Check()
{
var currentBranch = _configFileService.Branch.ToLower();
if (!Enum.GetNames(typeof(ReleaseBranches)).Any(x => x.ToLower() == currentBranch))
{
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.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());
}
public enum ReleaseBranches
{
Aphrodite
}
}
}