Skip to content

Commit 919ce24

Browse files
authored
BUG: Fix --notify on preview and on error (#3616)
1 parent d042b3e commit 919ce24

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

commands/ppreviewPush.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -516,25 +516,25 @@ func pprintOrRunCorrections(zoneName string, providerName string, corrections []
516516
cc++
517517
}
518518

519-
var err error
520-
if push {
521-
// If interactive, ask "are you sure?" and skip if not.
522-
if interactive && !out.PromptToRun() {
523-
continue
524-
}
519+
// If interactive, ask "are you sure?" and skip if not.
520+
if push && interactive && !out.PromptToRun() {
521+
continue
522+
}
525523

526-
// If it is an action (not an informational message), notify and execute.
527-
if correction.F != nil {
528-
err = notifier.Notify(zoneName, providerName, correction.Msg, err, false)
529-
if err != nil {
530-
out.Printf("Error sending notification: %s\n", err)
531-
}
524+
// If it is an action (not an informational message), notify and execute.
525+
if correction.F != nil {
526+
var err error
527+
if push {
532528
err = correction.F()
533529
out.EndCorrection(err)
534530
if err != nil {
535531
anyErrors = true
536532
}
537533
}
534+
notifyErr := notifier.Notify(zoneName, providerName, correction.Msg, err, !push)
535+
if notifyErr != nil {
536+
out.Warnf("Error sending notification: %s\n", notifyErr)
537+
}
538538
}
539539
}
540540

0 commit comments

Comments
 (0)