Updated packages and more logging

pull/1514/head
Jamie.Rees 7 years ago
parent c263462fea
commit a727bc0b4c

@ -11,7 +11,7 @@
<ItemGroup>
<PackageReference Include="AutoMapper" Version="6.1.1" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="3.0.1" />
<PackageReference Include="Hangfire" Version="1.6.16" />
<PackageReference Include="Hangfire" Version="1.6.17" />
<PackageReference Include="Microsoft.AspNetCore.Cryptography.KeyDerivation" Version="2.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Design" Version="1.1.2" />

@ -52,7 +52,7 @@ namespace Ombi.Schedule.Jobs.Ombi
Logger.LogInformation(LoggingEvents.Updater, "Version {0}", version);
Logger.LogInformation(LoggingEvents.Updater, "Branch {0}", branch);
c.WriteLine("Looking for updates now");
var updates = await OmbiService.GetUpdates(branch);
c.WriteLine("Updates: {0}", updates);
@ -68,6 +68,7 @@ namespace Ombi.Schedule.Jobs.Ombi
var proce = RuntimeInformation.ProcessArchitecture;
Logger.LogInformation(LoggingEvents.Updater, "OS Information: {0} {1}", desc, proce);
c.WriteLine("OS Information: {0} {1}", desc, proce);
Download download;
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
@ -113,10 +114,14 @@ namespace Ombi.Schedule.Jobs.Ombi
return;
}
c.WriteLine("Found the download! {0}", download.Name);
c.WriteLine("URL {0}", download.Url);
// Download it
Logger.LogInformation(LoggingEvents.Updater, "Downloading the file {0} from {1}", download.Name, download.Url);
var extension = download.Name.Split('.').Last();
var zipDir = Path.Combine(currentLocation, $"Ombi.{extension}");
c.WriteLine("Zip Dir: {0}", zipDir);
try
{
if (File.Exists(zipDir))
@ -124,20 +129,25 @@ namespace Ombi.Schedule.Jobs.Ombi
File.Delete(zipDir);
}
c.WriteLine("Starting Download");
await DownloadAsync(download.Url, zipDir);
c.WriteLine("Finished Download");
}
catch (Exception e)
{
c.WriteLine("Error when downloading");
c.WriteLine(e.Message);
Logger.LogError(LoggingEvents.Updater, e, "Error when downloading the zip");
throw;
}
c.WriteLine("Clearing out Temp Path");
var tempPath = Path.Combine(currentLocation, "TempUpdate");
if (Directory.Exists(tempPath))
{
Directory.Delete(tempPath, true);
}
// Extract it
c.WriteLine("Extracting ZIP");
using (var files = ZipFile.OpenRead(zipDir))
{
// Temp Path
@ -153,7 +163,8 @@ namespace Ombi.Schedule.Jobs.Ombi
entry.ExtractToFile(Path.Combine(tempPath, entry.FullName));
}
}
c.WriteLine("Finished Extracting files");
c.WriteLine("Starting the Ombi.Updater process");
// There must be an update
var start = new ProcessStartInfo
{
@ -166,6 +177,7 @@ namespace Ombi.Schedule.Jobs.Ombi
{
proc.Start();
}
c.WriteLine("Bye bye");
}
}
catch (Exception e)

@ -9,12 +9,12 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Hangfire" Version="1.6.16" />
<PackageReference Include="Hangfire.AspNetCore" Version="1.6.16" />
<PackageReference Include="Hangfire" Version="1.6.17" />
<PackageReference Include="Hangfire.AspNetCore" Version="1.6.17" />
<PackageReference Include="Hangfire.Console" Version="1.3.6" />
<PackageReference Include="Hangfire.MemoryStorage.Core" Version="1.4.0" />
<PackageReference Include="Hangfire.RecurringJobExtensions" Version="1.1.6" />
<PackageReference Include="Serilog" Version="2.5.0" />
<PackageReference Include="Serilog" Version="2.6.0-dev-00892" />
<PackageReference Include="System.Diagnostics.Process" Version="4.3.0" />
</ItemGroup>

@ -53,7 +53,7 @@
<ItemGroup>
<PackageReference Include="AutoMapper" Version="6.1.1" />
<PackageReference Include="CommandLineParser" Version="2.1.1-beta" />
<PackageReference Include="Hangfire.AspNetCore" Version="1.6.16" />
<PackageReference Include="Hangfire.AspNetCore" Version="1.6.17" />
<PackageReference Include="Hangfire.Console" Version="1.3.6" />
<PackageReference Include="Hangfire.MemoryStorage.Core" Version="1.4.0" />
<PackageReference Include="Hangfire.RecurringJobExtensions" Version="1.1.6" />
@ -63,10 +63,10 @@
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="2.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="2.0.0" />
<PackageReference Include="MiniProfiler.AspNetCore.Mvc" Version="4.0.0-alpha6-79" />
<PackageReference Include="Serilog" Version="2.5.0" />
<PackageReference Include="Serilog" Version="2.6.0-dev-00892" />
<PackageReference Include="Serilog.Extensions.Logging" Version="2.0.2" />
<PackageReference Include="Serilog.Sinks.File" Version="3.2.0" />
<PackageReference Include="Serilog.Sinks.RollingFile" Version="3.3.0" />
<PackageReference Include="Serilog.Sinks.RollingFile" Version="3.3.1-dev-00771" />
<PackageReference Include="Serilog.Sinks.SQLite" Version="3.8.3" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="1.0.0" />
<PackageReference Include="System.Security.Cryptography.Csp" Version="4.3.0" />

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="dotnet-core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
</packageSources>
</configuration>
Loading…
Cancel
Save