You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by li...@apache.org on 2017/12/27 04:11:09 UTC

[incubator-servicecomb-service-center] branch master updated: SCB-134 Batch delete api can delete service center micro-service. (#229)

This is an automated email from the ASF dual-hosted git repository.

littlecui pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-servicecomb-service-center.git


The following commit(s) were added to refs/heads/master by this push:
     new 57a0004  SCB-134 Batch delete api can delete service center micro-service. (#229)
57a0004 is described below

commit 57a0004007781b21641b7319ceb38966bcd23a26
Author: little-cui <su...@qq.com>
AuthorDate: Wed Dec 27 12:11:08 2017 +0800

    SCB-134 Batch delete api can delete service center micro-service. (#229)
---
 server/service/microservices.go | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/server/service/microservices.go b/server/service/microservices.go
index 9811471..0f304a8 100644
--- a/server/service/microservices.go
+++ b/server/service/microservices.go
@@ -210,6 +210,12 @@ func (s *MicroServiceService) DeleteServicePri(ctx context.Context, ServiceId st
 		title = "force delete"
 	}
 
+	if ServiceId == apt.Service.ServiceId {
+		err := fmt.Errorf("Not allow to delete service center")
+		util.Logger().Errorf(err, "%s microservice failed, serviceId is %s", title, ServiceId)
+		return pb.CreateResponse(scerr.ErrInvalidParams, err.Error()), err
+	}
+
 	service, err := serviceUtil.GetService(ctx, domainProject, ServiceId)
 	if err != nil {
 		util.Logger().Errorf(err, "%s microservice failed, serviceId is %s: get service failed.", title, ServiceId)
@@ -327,7 +333,7 @@ func (s *MicroServiceService) DeleteServicePri(ctx context.Context, ServiceId st
 }
 
 func (s *MicroServiceService) Delete(ctx context.Context, in *pb.DeleteServiceRequest) (*pb.DeleteServiceResponse, error) {
-	if in == nil || len(in.ServiceId) == 0 || in.ServiceId == apt.Service.ServiceId {
+	if in == nil || len(in.ServiceId) == 0 {
 		util.Logger().Errorf(nil, "delete microservice failed: service empty.")
 		return &pb.DeleteServiceResponse{
 			Response: pb.CreateResponse(scerr.ErrInvalidParams, "Request format invalid."),

-- 
To stop receiving notification emails like this one, please contact
['"commits@servicecomb.apache.org" <co...@servicecomb.apache.org>'].