mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-10-30 07:22:35 +01:00
Also force branch if an external updater is used.
This commit is contained in:
parent
565e625e21
commit
524048c4b4
@ -1,4 +1,5 @@
|
||||
using NLog;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Lifecycle;
|
||||
using NzbDrone.Core.Messaging.Events;
|
||||
@ -48,6 +49,17 @@ namespace NzbDrone.Core.Update
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (_deploymentInfoProvider.IsExternalUpdateMechanism)
|
||||
{
|
||||
var currentBranch = _configFileProvider.Branch;
|
||||
var packageBranch = _deploymentInfoProvider.PackageBranch;
|
||||
if (packageBranch.IsNotNullOrWhiteSpace() & packageBranch != currentBranch)
|
||||
{
|
||||
_logger.Info("External updater uses branch {0} instead of the currently selected {1}, changing to {0}.", packageBranch, currentBranch);
|
||||
ChangeBranch(packageBranch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ChangeUpdateMechanism(UpdateMechanism updateMechanism)
|
||||
@ -58,5 +70,14 @@ namespace NzbDrone.Core.Update
|
||||
};
|
||||
_configFileProvider.SaveConfigDictionary(config);
|
||||
}
|
||||
|
||||
private void ChangeBranch(string branch)
|
||||
{
|
||||
var config = new Dictionary<string, object>
|
||||
{
|
||||
[nameof(_configFileProvider.Branch)] = branch
|
||||
};
|
||||
_configFileProvider.SaveConfigDictionary(config);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user