Skip to content
This repository has been archived by the owner on Mar 26, 2020. It is now read-only.

Commit

Permalink
Merge pull request #170 from prashanthpai/disallow-deleting-self
Browse files Browse the repository at this point in the history
Disallow deleting self peer
  • Loading branch information
kshlm authored Nov 17, 2016
2 parents ed1771a + b79b3ae commit ac37e33
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions commands/peers/deletepeer.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"net/http"

"github.com/gluster/glusterd2/etcdmgmt"
"github.com/gluster/glusterd2/gdctx"
"github.com/gluster/glusterd2/peer"
"github.com/gluster/glusterd2/rest"

Expand All @@ -30,6 +31,12 @@ func deletePeerHandler(w http.ResponseWriter, r *http.Request) {
return
}

// Removing self should be disallowed (like in glusterd1)
if id == gdctx.MyUUID.String() {
rest.SendHTTPError(w, http.StatusBadRequest, "Removing self is disallowed.")
return
}

// Validate whether the peer can be deleted
rsp, e := ValidateDeletePeer(id, p.Name)
if e != nil {
Expand Down

0 comments on commit ac37e33

Please sign in to comment.