Run container restart after certificate copy so exchange takes effect.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -191,29 +191,85 @@ public sealed class DeploymentOrchestrator
|
||||
target.BackupDirectoryName,
|
||||
cancellationToken);
|
||||
|
||||
string copyStatus = $"Zertifikat kopiert: {Path.GetFileName(deployedFilePath)}";
|
||||
string copyStatus =
|
||||
$"Zertifikat kopiert: {Path.GetFileName(deployedFilePath)}";
|
||||
|
||||
steps.Add(copyStatus);
|
||||
logger.Write($"[{target.Name}] {copyStatus} | Ziel={deployedFilePath}");
|
||||
logger.Write(
|
||||
$"[{target.Name}] {copyStatus} | Ziel={deployedFilePath}");
|
||||
|
||||
progress?.Report(new TargetProgressUpdate(
|
||||
target.Id,
|
||||
copyStatus,
|
||||
true));
|
||||
|
||||
// Nach dem Dateitausch Container neu starten, damit Sonic
|
||||
// das neue Zertifikat lädt. Ohne Neustart bleibt oft das Alte aktiv.
|
||||
bool restartNeeded =
|
||||
target.RestartType is RestartType.SonicContainer
|
||||
or RestartType.SonicContainerWithXapi
|
||||
|| !string.IsNullOrWhiteSpace(target.ContainerName);
|
||||
|
||||
if (!restartNeeded)
|
||||
{
|
||||
return new TargetStepResult
|
||||
{
|
||||
TargetId = target.Id,
|
||||
TargetName = target.Name,
|
||||
Success = true,
|
||||
StatusText = "Kopieren erfolgreich (kein Neustart)",
|
||||
Detail = deployedFilePath,
|
||||
Steps = steps,
|
||||
StartedAt = targetStart,
|
||||
FinishedAt = DateTimeOffset.Now,
|
||||
CopySucceeded = true,
|
||||
RestartSucceeded = true,
|
||||
TlsSucceeded = true,
|
||||
ObservedFingerprint = null
|
||||
};
|
||||
}
|
||||
|
||||
progress?.Report(new TargetProgressUpdate(
|
||||
target.Id,
|
||||
"Zertifikat kopiert – Container-Neustart …",
|
||||
true));
|
||||
|
||||
(bool restartOk, string restartStatus, string? restartDetail) =
|
||||
await _restartExecutor.ExecuteAsync(
|
||||
target,
|
||||
cancellationToken);
|
||||
|
||||
string restartStep =
|
||||
$"{restartStatus}: {restartDetail}";
|
||||
|
||||
steps.Add(restartStep);
|
||||
logger.Write(
|
||||
$"[{target.Name}] Restart nach Deploy: {restartStep}");
|
||||
|
||||
progress?.Report(new TargetProgressUpdate(
|
||||
target.Id,
|
||||
restartOk
|
||||
? "Austausch + Neustart OK"
|
||||
: restartStatus,
|
||||
restartOk));
|
||||
|
||||
return new TargetStepResult
|
||||
{
|
||||
TargetId = target.Id,
|
||||
TargetName = target.Name,
|
||||
Success = true,
|
||||
StatusText = "Kopieren erfolgreich",
|
||||
Detail = deployedFilePath,
|
||||
Success = restartOk,
|
||||
StatusText = restartOk
|
||||
? "Austausch + Neustart OK"
|
||||
: $"Kopiert, Neustart fehlgeschlagen: {restartStatus}",
|
||||
Detail =
|
||||
$"Datei={deployedFilePath}"
|
||||
+ Environment.NewLine
|
||||
+ (restartDetail ?? string.Empty),
|
||||
Steps = steps,
|
||||
StartedAt = targetStart,
|
||||
FinishedAt = DateTimeOffset.Now,
|
||||
|
||||
CopySucceeded = true,
|
||||
RestartSucceeded = true,
|
||||
RestartSucceeded = restartOk,
|
||||
TlsSucceeded = true,
|
||||
ObservedFingerprint = null
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user