New: automatically switch back to master if current branch is invalid
This commit is contained in:
parent
95d67ef9f4
commit
aa68faaf88
|
@ -23,6 +23,13 @@ namespace NzbDrone.Core.Test.UpdateTests
|
|||
Subject.GetLatestUpdate("master", new Version(2, 0)).Should().NotBeNull();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_get_master_if_branch_doesnt_exit()
|
||||
{
|
||||
UseRealHttp();
|
||||
Subject.GetLatestUpdate("master2", new Version(2, 0)).Should().NotBeNull();
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void should_get_recent_updates()
|
||||
|
@ -37,6 +44,7 @@ namespace NzbDrone.Core.Test.UpdateTests
|
|||
recent.Should().OnlyContain(c => c.ReleaseDate.Year == 2014);
|
||||
recent.Should().OnlyContain(c => c.Changes.New != null);
|
||||
recent.Should().OnlyContain(c => c.Changes.Fixed != null);
|
||||
recent.Should().OnlyContain(c => c.Branch == branch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ namespace NzbDrone.Core.Jobs
|
|||
{
|
||||
new ScheduledTask{ Interval = 1, TypeName = typeof(TrackedCommandCleanupCommand).FullName},
|
||||
new ScheduledTask{ Interval = 1, TypeName = typeof(CheckForFinishedDownloadCommand).FullName},
|
||||
new ScheduledTask{ Interval = 1*60, TypeName = typeof(ApplicationUpdateCommand).FullName},
|
||||
new ScheduledTask{ Interval = 6*60, TypeName = typeof(ApplicationUpdateCommand).FullName},
|
||||
new ScheduledTask{ Interval = 1*60, TypeName = typeof(TrimLogCommand).FullName},
|
||||
new ScheduledTask{ Interval = 3*60, TypeName = typeof(UpdateSceneMappingCommand).FullName},
|
||||
new ScheduledTask{ Interval = 6*60, TypeName = typeof(CheckHealthCommand).FullName},
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -11,5 +11,6 @@ namespace NzbDrone.Core.Update
|
|||
public String Url { get; set; }
|
||||
public UpdateChanges Changes { get; set; }
|
||||
public String Hash { get; set; }
|
||||
public String Branch { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue