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++
}
var err error
if push {
// If interactive, ask "are you sure?" and skip if not.
if interactive && !out.PromptToRun() {
continue
}
// If interactive, ask "are you sure?" and skip if not.
if push && interactive && !out.PromptToRun() {
continue
}
// If it is an action (not an informational message), notify and execute.
if correction.F != nil {
err = notifier.Notify(zoneName, providerName, correction.Msg, err, false)
if err != nil {
out.Printf("Error sending notification: %s\n", err)
}
// If it is an action (not an informational message), notify and execute.
if correction.F != nil {
var err error
if push {
err = correction.F()
out.EndCorrection(err)
if err != nil {
anyErrors = true
}
}
notifyErr := notifier.Notify(zoneName, providerName, correction.Msg, err, !push)
if notifyErr != nil {
out.Warnf("Error sending notification: %s\n", notifyErr)
}
}
}