fix bucket clear check
This commit is contained in:
parent
d4776b578a
commit
3051fa69a8
@ -5,8 +5,8 @@
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<AssemblyVersion>1.6.0</AssemblyVersion>
|
||||
<FileVersion>1.6.0</FileVersion>
|
||||
<AssemblyVersion>1.6.1</AssemblyVersion>
|
||||
<FileVersion>1.6.1</FileVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -49,12 +49,18 @@ public class R2Helper
|
||||
return false;
|
||||
}
|
||||
|
||||
if (listBucketResponse.S3Objects.Count == 0)
|
||||
{
|
||||
AnsiConsole.MarkupLine("[green]bucket is empty[/]");
|
||||
return true;
|
||||
}
|
||||
|
||||
AnsiConsole.MarkupLine("[blue]Removing old content[/]");
|
||||
foreach (var s3Object in listBucketResponse.S3Objects)
|
||||
{
|
||||
var deleteResponse = await _client.DeleteObjectAsync(BucketName, s3Object.Key);
|
||||
|
||||
if (deleteResponse.HttpStatusCode != HttpStatusCode.OK)
|
||||
if ((int)deleteResponse.HttpStatusCode < 200 || (int)deleteResponse.HttpStatusCode > 299)
|
||||
{
|
||||
AnsiConsole.MarkupLine($"[red]failed to delete {BucketName}::{s3Object.Key}[/]");
|
||||
return false;
|
||||
|
@ -32,8 +32,15 @@ namespace EftPatchHelper
|
||||
var version = Assembly.GetExecutingAssembly().GetName().Version;
|
||||
AnsiConsole.Write(new Rule($"[purple]v{version}[/]").Centered().RuleStyle("blue"));
|
||||
|
||||
var host = ConfigureHost(args);
|
||||
host.Services.GetRequiredService<Program>().Run();
|
||||
try
|
||||
{
|
||||
var host = ConfigureHost(args);
|
||||
host.Services.GetRequiredService<Program>().Run();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
AnsiConsole.MarkupLine($"[red]{ex.Message.EscapeMarkup()}[/]");
|
||||
}
|
||||
|
||||
AnsiConsole.MarkupLine("Press [blue]Enter[/] to close ...");
|
||||
Console.ReadLine();
|
||||
|
@ -74,7 +74,7 @@ namespace EftPatchHelper.Tasks
|
||||
|
||||
if (_settings.UsingR2())
|
||||
{
|
||||
_options.UplaodToR2 = new ConfirmationPrompt("Upload to R2?").Show(AnsiConsole.Console);
|
||||
_options.UplaodToR2 = new ConfirmationPrompt($"Upload to R2 ({_settings.R2BucketName})?").Show(AnsiConsole.Console);
|
||||
}
|
||||
|
||||
if (_settings.SftpUploads.Count > 0)
|
||||
|
@ -41,10 +41,12 @@ namespace EftPatchHelper.Tasks
|
||||
|
||||
public bool CreateMirrorList(FileInfo mirrorListFileInfo)
|
||||
{
|
||||
var sourcePatchVersion = _options.SourceClient.Version.Split('.').Last();
|
||||
var targetPatchVersion = _options.TargetClient.Version.Split('.').Last();
|
||||
var mirrorInfo = new PatchInfo
|
||||
{
|
||||
SourceClientVersion = int.Parse(_options.SourceClient.Version),
|
||||
TargetClientVersion = int.Parse(_options.TargetClient.Version),
|
||||
SourceClientVersion = int.Parse(sourcePatchVersion),
|
||||
TargetClientVersion = int.Parse(targetPatchVersion),
|
||||
Mirrors = _options.MirrorList.Values.ToList()
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user