mirror of
https://github.com/Radarr/Radarr.git
synced 2026-04-26 22:46:53 -04:00
Fixed: Automation/Integration/Unit Tests
This commit is contained in:
@@ -32,6 +32,7 @@ namespace NzbDrone.Core.Update
|
||||
private readonly IConfigFileProvider _configFileProvider;
|
||||
private readonly IRuntimeInfo _runtimeInfo;
|
||||
private readonly IBackupService _backupService;
|
||||
private readonly IOsInfo _osInfo;
|
||||
|
||||
|
||||
public InstallUpdateService(ICheckUpdateService checkUpdateService,
|
||||
@@ -46,6 +47,7 @@ namespace NzbDrone.Core.Update
|
||||
IConfigFileProvider configFileProvider,
|
||||
IRuntimeInfo runtimeInfo,
|
||||
IBackupService backupService,
|
||||
IOsInfo osInfo,
|
||||
Logger logger)
|
||||
{
|
||||
if (configFileProvider == null)
|
||||
@@ -64,6 +66,7 @@ namespace NzbDrone.Core.Update
|
||||
_configFileProvider = configFileProvider;
|
||||
_runtimeInfo = runtimeInfo;
|
||||
_backupService = backupService;
|
||||
_osInfo = osInfo;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
@@ -209,6 +212,11 @@ namespace NzbDrone.Core.Update
|
||||
return;
|
||||
}
|
||||
|
||||
if (_osInfo.IsDocker)
|
||||
{
|
||||
throw new CommandFailedException("Updating is disabled inside a docker container. Please update the container image.");
|
||||
}
|
||||
|
||||
if (OsInfo.IsNotWindows && !_configFileProvider.UpdateAutomatically && message.Trigger != CommandTrigger.Manual)
|
||||
{
|
||||
_logger.ProgressDebug("Auto-update not enabled, not installing available update.");
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using NzbDrone.Common.Cloud;
|
||||
using NzbDrone.Common.EnvironmentInfo;
|
||||
using NzbDrone.Common.Http;
|
||||
using NzbDrone.Core.Analytics;
|
||||
|
||||
namespace NzbDrone.Core.Update
|
||||
{
|
||||
@@ -15,14 +16,16 @@ namespace NzbDrone.Core.Update
|
||||
public class UpdatePackageProvider : IUpdatePackageProvider
|
||||
{
|
||||
private readonly IHttpClient _httpClient;
|
||||
private readonly IPlatformInfo _platformInfo;
|
||||
private readonly IHttpRequestBuilderFactory _requestBuilder;
|
||||
private readonly IPlatformInfo _platformInfo;
|
||||
private readonly IAnalyticsService _analyticsService;
|
||||
|
||||
public UpdatePackageProvider(IHttpClient httpClient, IRadarrCloudRequestBuilder requestBuilder, IPlatformInfo platformInfo)
|
||||
public UpdatePackageProvider(IHttpClient httpClient, IRadarrCloudRequestBuilder requestBuilder, IAnalyticsService analyticsService, IPlatformInfo platformInfo)
|
||||
{
|
||||
_httpClient = httpClient;
|
||||
_platformInfo = platformInfo;
|
||||
_analyticsService = analyticsService;
|
||||
_requestBuilder = requestBuilder.Services;
|
||||
_httpClient = httpClient;
|
||||
}
|
||||
|
||||
public UpdatePackage GetLatestUpdate(string branch, Version currentVersion)
|
||||
@@ -32,10 +35,15 @@ namespace NzbDrone.Core.Update
|
||||
.AddQueryParam("version", currentVersion)
|
||||
.AddQueryParam("os", OsInfo.Os.ToString().ToLowerInvariant())
|
||||
.AddQueryParam("runtimeVer", _platformInfo.Version)
|
||||
.SetSegment("branch", branch)
|
||||
.Build();
|
||||
.SetSegment("branch", branch);
|
||||
|
||||
var update = _httpClient.Get<UpdatePackageAvailable>(request).Resource;
|
||||
if (_analyticsService.IsEnabled)
|
||||
{
|
||||
// Send if the system is active so we know which versions to deprecate/ignore
|
||||
request.AddQueryParam("active", _analyticsService.InstallIsActive.ToString().ToLower());
|
||||
}
|
||||
|
||||
var update = _httpClient.Get<UpdatePackageAvailable>(request.Build()).Resource;
|
||||
|
||||
if (!update.Available) return null;
|
||||
|
||||
@@ -49,12 +57,17 @@ namespace NzbDrone.Core.Update
|
||||
.AddQueryParam("version", currentVersion)
|
||||
.AddQueryParam("os", OsInfo.Os.ToString().ToLowerInvariant())
|
||||
.AddQueryParam("runtimeVer", _platformInfo.Version)
|
||||
.SetSegment("branch", branch)
|
||||
.Build();
|
||||
.SetSegment("branch", branch);
|
||||
|
||||
var updates = _httpClient.Get<List<UpdatePackage>>(request);
|
||||
if (_analyticsService.IsEnabled)
|
||||
{
|
||||
// Send if the system is active so we know which versions to deprecate/ignore
|
||||
request.AddQueryParam("active", _analyticsService.InstallIsActive.ToString().ToLower());
|
||||
}
|
||||
|
||||
var updates = _httpClient.Get<List<UpdatePackage>>(request.Build());
|
||||
|
||||
return updates.Resource;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user