mirror of
https://github.com/kubereboot/kured.git
synced 2026-05-06 00:17:24 +00:00
Raise the error levels for wrong flag
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>
This commit is contained in:
@@ -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/"))
|
||||
|
||||
Reference in New Issue
Block a user