mirror of
https://github.com/Radarr/Radarr
synced 2024-12-26 17:59:14 +00:00
Merge pull request #127 from NzbDrone/wtf-gtfo
New: automatically switch back to master if current branch is invalid
This commit is contained in:
commit
1eaef4360d
4 changed files with 27 additions and 2 deletions
|
@ -23,6 +23,13 @@ public void finds_update_when_version_lower()
|
|||
Subject.GetLatestUpdate("master", new Version(2, 0)).Should().NotBeNull();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_get_master_if_branch_doesnt_exit()
|
||||
{
|
||||
UseRealHttp();
|
||||
Subject.GetLatestUpdate("invalid_branch", new Version(2, 0)).Should().NotBeNull();
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void should_get_recent_updates()
|
||||
|
@ -37,6 +44,7 @@ public void should_get_recent_updates()
|
|||
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 @@ public void Handle(ApplicationStartedEvent message)
|
|||
{
|
||||
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 @@ public UpdatePackage AvailableUpdate()
|
|||
{
|
||||
_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 @@ public class UpdatePackage
|
|||
public String Url { get; set; }
|
||||
public UpdateChanges Changes { get; set; }
|
||||
public String Hash { get; set; }
|
||||
public String Branch { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue