fix: complete reset recovery safety

This commit is contained in:
proxyctl coordinator
2026-07-17 11:25:09 +08:00
parent 9e2418f45e
commit 4cf9731db4
9 changed files with 339 additions and 52 deletions
+6
View File
@@ -348,6 +348,12 @@ func (a *Adapter) disable(ctx context.Context) error {
alreadyOriginal := metadata.OriginalExists && currentErr == nil && fingerprint(current) == fingerprint(metadata.Original)
alreadyAbsent := !metadata.OriginalExists && errors.Is(currentErr, fs.ErrNotExist)
if alreadyOriginal || alreadyAbsent {
// Recovery metadata proves proxyctl previously changed the effective
// daemon configuration. Even when the file has already been restored,
// complete the service effects before relinquishing that recovery record.
if err := a.reloadRestartInspect(ctx); err != nil {
return err
}
if err := a.files.Remove(a.configuration.RecoveryPath); err != nil && !errors.Is(err, fs.ErrNotExist) {
return fmt.Errorf("clean Docker daemon recovery metadata for already-restored configuration: %w", err)
}