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

[GitHub] little-cui closed pull request #229: SCB-134 Batch delete api can delete service center micro-service.

little-cui closed pull request #229: SCB-134 Batch delete api can delete service center micro-service.
URL: https://github.com/apache/incubator-servicecomb-service-center/pull/229
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/server/service/microservices.go b/server/service/microservices.go
index 98114719..0f304a8f 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."),


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services