Skip to content

Commit

Permalink
Raise the error levels for wrong flag
Browse files Browse the repository at this point in the history
If the notification url configuration is known to be not working,
this should be raised as an error, not a warning.

Without this, it would be easy to miss a misconfiguration.

Signed-off-by: Jean-Philippe Evrard <open-source@a.spamming.party>
  • Loading branch information
evrardjp committed Oct 17, 2024
1 parent 07770ea commit f757d38
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cmd/kured/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,11 +313,11 @@ func validateNotificationURL(notifyURL string, slackHookURL string) string {
log.Warnf("Deprecated flag(s). Please use --notify-url flag instead.")
parsedURL, err := url.Parse(stripQuotes(slackHookURL))
if err != nil {
log.Warnf("slack-hook-url is not properly formatted... no notification will be sent: %v\n", err)
log.Errorf("slack-hook-url is not properly formatted... no notification will be sent: %v\n", err)
return ""
}
if len(strings.Split(strings.Trim(parsedURL.Path, "/services/"), "/")) != 3 {
log.Warnf("slack-hook-url is not properly formatted... no notification will be sent: unexpected number of / in URL\n")
log.Errorf("slack-hook-url is not properly formatted... no notification will be sent: unexpected number of / in URL\n")
return ""
}
return fmt.Sprintf("slack://%s", strings.Trim(parsedURL.Path, "/services/"))
Expand Down

0 comments on commit f757d38

Please sign in to comment.