mirror of
https://gitee.com/rainbond/Rainbond.git
synced 2024-12-01 11:18:08 +08:00
[REV] backup not support thirdpart service
This commit is contained in:
parent
742c87d02e
commit
962140db1c
@ -210,6 +210,14 @@ type RegionServiceSnapshot struct {
|
||||
func (h *BackupHandle) snapshot(ids []string, sourceDir string) error {
|
||||
var datas []RegionServiceSnapshot
|
||||
for _, id := range ids {
|
||||
service, err := db.GetManager().TenantServiceDao().GetServiceByID(id)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Get service(%s) error %s", id, err.Error())
|
||||
}
|
||||
if dbmodel.ServiceKind(service.Kind) == dbmodel.ServiceKindThirdParty {
|
||||
//TODO: support thirdpart service backup and restore
|
||||
continue
|
||||
}
|
||||
var data = RegionServiceSnapshot{
|
||||
ServiceID: id,
|
||||
}
|
||||
@ -222,10 +230,6 @@ func (h *BackupHandle) snapshot(ids []string, sourceDir string) error {
|
||||
return fmt.Errorf("Statefulset app must be closed before backup,%s", err.Error())
|
||||
}
|
||||
data.ServiceStatus = status
|
||||
service, err := db.GetManager().TenantServiceDao().GetServiceByID(id)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Get service(%s) error %s", id, err.Error())
|
||||
}
|
||||
data.Service = service
|
||||
serviceProbes, err := db.GetManager().ServiceProbeDao().GetServiceProbes(id)
|
||||
if err != nil && err.Error() != gorm.ErrRecordNotFound.Error() {
|
||||
|
@ -62,6 +62,10 @@ func (o *OperationHandler) Build(buildInfo model.BuildInfoRequestStruct) (re Ope
|
||||
re.ErrMsg = fmt.Sprintf("find service %s failure", buildInfo.ServiceID)
|
||||
return
|
||||
}
|
||||
if dbmodel.ServiceKind(service.Kind) == dbmodel.ServiceKindThirdParty {
|
||||
re.ErrMsg = fmt.Sprintf("service %s is thirdpart service", buildInfo.ServiceID)
|
||||
return
|
||||
}
|
||||
eventBody, err := createEvent(buildInfo.EventID, buildInfo.ServiceID, "build", service.TenantID)
|
||||
if err != nil {
|
||||
if err == ErrEventIsRuning {
|
||||
@ -143,6 +147,11 @@ func (o *OperationHandler) Stop(stopInfo model.StartOrStopInfoRequestStruct) (re
|
||||
if err != nil {
|
||||
logrus.Errorf("get service by id error, %v", err)
|
||||
re.ErrMsg = fmt.Sprintf("get service %s failure", stopInfo.ServiceID)
|
||||
return
|
||||
}
|
||||
if dbmodel.ServiceKind(service.Kind) == dbmodel.ServiceKindThirdParty {
|
||||
re.ErrMsg = fmt.Sprintf("service %s is thirdpart service", stopInfo.ServiceID)
|
||||
return
|
||||
}
|
||||
event, err := createEvent(stopInfo.EventID, stopInfo.ServiceID, "stop", service.TenantID)
|
||||
if err != nil {
|
||||
@ -182,6 +191,11 @@ func (o *OperationHandler) Start(startInfo model.StartOrStopInfoRequestStruct) (
|
||||
if err != nil {
|
||||
logrus.Errorf("get service by id error, %v", err)
|
||||
re.ErrMsg = fmt.Sprintf("get service %s failure", startInfo.ServiceID)
|
||||
return
|
||||
}
|
||||
if dbmodel.ServiceKind(service.Kind) == dbmodel.ServiceKindThirdParty {
|
||||
re.ErrMsg = fmt.Sprintf("service %s is thirdpart service", startInfo.ServiceID)
|
||||
return
|
||||
}
|
||||
eventBody, err := createEvent(startInfo.EventID, startInfo.ServiceID, "start", service.TenantID)
|
||||
if err != nil {
|
||||
@ -224,6 +238,10 @@ func (o *OperationHandler) Upgrade(ru model.UpgradeInfoRequestStruct) (re Operat
|
||||
re.ErrMsg = fmt.Sprintf("get service %s failure", ru.ServiceID)
|
||||
return
|
||||
}
|
||||
if dbmodel.ServiceKind(services.Kind) == dbmodel.ServiceKindThirdParty {
|
||||
re.ErrMsg = fmt.Sprintf("service %s is thirdpart service", ru.ServiceID)
|
||||
return
|
||||
}
|
||||
eventBody, err := createEvent(ru.EventID, ru.ServiceID, "upgrade", services.TenantID)
|
||||
if err != nil {
|
||||
if err == ErrEventIsRuning {
|
||||
@ -280,6 +298,10 @@ func (o *OperationHandler) RollBack(rollback model.RollbackInfoRequestStruct) (r
|
||||
re.ErrMsg = fmt.Sprintf("find service %s failure", rollback.ServiceID)
|
||||
return
|
||||
}
|
||||
if dbmodel.ServiceKind(service.Kind) == dbmodel.ServiceKindThirdParty {
|
||||
re.ErrMsg = fmt.Sprintf("service %s is thirdpart service", rollback.ServiceID)
|
||||
return
|
||||
}
|
||||
eventBody, err := createEvent(rollback.EventID, rollback.ServiceID, "upgrade", service.TenantID)
|
||||
if err != nil {
|
||||
if err == ErrEventIsRuning {
|
||||
|
Loading…
Reference in New Issue
Block a user