ensure hooks run after restart (#494) (#497)

(cherry picked from commit 99df4ca3cd)
This commit is contained in:
h44z
2025-08-12 21:47:04 +02:00
committed by Christoph Haas
parent eb6a787cfc
commit 0cc7ebb83e

View File

@@ -217,6 +217,15 @@ func (m Manager) RestoreInterfaceState(
if err != nil && !iface.IsDisabled() {
slog.Debug("creating missing interface", "interface", iface.Identifier)
// temporarily disable interface in database so that the current state is reflected correctly
_ = m.db.SaveInterface(ctx, iface.Identifier,
func(in *domain.Interface) (*domain.Interface, error) {
now := time.Now()
in.Disabled = &now // set
in.DisabledReason = domain.DisabledReasonInterfaceMissing
return in, nil
})
// try to create a new interface
_, err = m.saveInterface(ctx, &iface)
if err != nil {