Просмотр исходного кода

create notification if it doesn't exist

Alexander Belanger 4 лет назад
Родитель
Сommit
0207e9943b
1 измененных файлов с 10 добавлено и 4 удалено
  1. 10 4
      api/server/handlers/kube_events/create.go

+ 10 - 4
api/server/handlers/kube_events/create.go

@@ -126,19 +126,25 @@ func notifyPodCrashing(
 		conf, err = config.Repo.NotificationConfig().CreateNotificationConfig(conf)
 
 		if err != nil {
-			fmt.Println("GOT AN ERROR 0", err)
+			return err
+		}
 
+		if err != nil {
+			return err
+		}
+
+		matchedRel.NotificationConfig = conf.ID
+		matchedRel, err = config.Repo.Release().UpdateRelease(matchedRel)
+
+		if err != nil {
 			return err
 		}
 
 		notifConfig = conf.ToNotificationConfigType()
 	} else if err != nil {
-		fmt.Println("GOT AN ERROR 1", err)
-
 		return err
 	} else if err == nil && conf != nil {
 		if !conf.ShouldNotify() {
-			fmt.Println("SHOULD NOTIFY WAS", conf.ShouldNotify())
 			return nil
 		}