BUG: Fix --notify on preview and on error (#3616)

This commit is contained in:
Hamish Moffatt 2025-06-14 01:12:32 +10:00 committed by GitHub
parent d042b3edf7
commit 919ce24769
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -516,25 +516,25 @@ func pprintOrRunCorrections(zoneName string, providerName string, corrections []
cc++ cc++
} }
var err error // If interactive, ask "are you sure?" and skip if not.
if push { if push && interactive && !out.PromptToRun() {
// If interactive, ask "are you sure?" and skip if not. continue
if interactive && !out.PromptToRun() { }
continue
}
// If it is an action (not an informational message), notify and execute. // If it is an action (not an informational message), notify and execute.
if correction.F != nil { if correction.F != nil {
err = notifier.Notify(zoneName, providerName, correction.Msg, err, false) var err error
if err != nil { if push {
out.Printf("Error sending notification: %s\n", err)
}
err = correction.F() err = correction.F()
out.EndCorrection(err) out.EndCorrection(err)
if err != nil { if err != nil {
anyErrors = true anyErrors = true
} }
} }
notifyErr := notifier.Notify(zoneName, providerName, correction.Msg, err, !push)
if notifyErr != nil {
out.Warnf("Error sending notification: %s\n", notifyErr)
}
} }
} }