mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-15 01:23:53 -07:00
New: automatically switch back to master if current branch is invalid
This commit is contained in:
parent
95d67ef9f4
commit
aa68faaf88
4 changed files with 27 additions and 2 deletions
|
@ -1,4 +1,5 @@
|
|||
using NLog;
|
||||
using System;
|
||||
using NLog;
|
||||
using NzbDrone.Common.EnvironmentInfo;
|
||||
using NzbDrone.Common.Instrumentation.Extensions;
|
||||
using NzbDrone.Core.Configuration;
|
||||
|
@ -40,6 +41,21 @@ namespace NzbDrone.Core.Update
|
|||
{
|
||||
_logger.ProgressDebug("No update available.");
|
||||
}
|
||||
else if (latestAvailable.Branch != _configFileProvider.Branch)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger.Warn("[{0}] isn't a valid branch. Switching back to [master]", _configFileProvider.Branch);
|
||||
var config = _configFileProvider.GetConfigDictionary();
|
||||
config["Branch"] = _configFileProvider.Branch;
|
||||
_configFileProvider.SaveConfigDictionary(config);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_logger.ErrorException("couldn't revert back to master.", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return latestAvailable;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue