mirror of
https://gitee.com/rainbond/Rainbond.git
synced 2024-11-30 10:48:15 +08:00
binding appID when creating service
This commit is contained in:
parent
985c9be20a
commit
7c6f9303bd
@ -39,11 +39,11 @@ import (
|
||||
mqclient "github.com/goodrain/rainbond/mq/client"
|
||||
validation "github.com/goodrain/rainbond/util/endpoint"
|
||||
"github.com/goodrain/rainbond/util/fuzzy"
|
||||
validator "github.com/goodrain/rainbond/util/govalidator"
|
||||
httputil "github.com/goodrain/rainbond/util/http"
|
||||
"github.com/goodrain/rainbond/worker/client"
|
||||
"github.com/jinzhu/gorm"
|
||||
"github.com/sirupsen/logrus"
|
||||
validator "github.com/goodrain/rainbond/util/govalidator"
|
||||
)
|
||||
|
||||
//V2Routes v2Routes
|
||||
@ -649,6 +649,17 @@ func (t *TenantStruct) CreateService(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
// Check if the application ID exists
|
||||
_, err := handler.GetTenantApplicationHandler().GetAppByID(ss.AppID)
|
||||
if err != nil || ss.AppID == "" {
|
||||
if err.Error() == gorm.ErrRecordNotFound.Error() {
|
||||
httputil.ReturnError(r, w, 404, "can't find application")
|
||||
return
|
||||
}
|
||||
httputil.ReturnError(r, w, 500, "get assign tenant application failed")
|
||||
return
|
||||
}
|
||||
|
||||
// clean etcd data(source check)
|
||||
handler.GetEtcdHandler().CleanServiceCheckData(ss.EtcdKey)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user