ape: Make RemoveChainLocalOverride set correct removed flag #1006
5 changed files with 3 additions and 14 deletions
|
@ -57,11 +57,7 @@ func removeRule(cmd *cobra.Command, _ []string) {
|
||||||
|
|
||||||
verifyResponse(cmd, resp.GetSignature(), resp.GetBody())
|
verifyResponse(cmd, resp.GetSignature(), resp.GetBody())
|
||||||
|
|
||||||
if resp.GetBody().GetRemoved() {
|
cmd.Println("Rule has been removed.")
|
||||||
cmd.Println("Rule has been removed.")
|
|
||||||
} else {
|
|
||||||
cmd.Println("Rule has not been removed.")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func initControlRemoveRuleCmd() {
|
func initControlRemoveRuleCmd() {
|
||||||
|
|
|
@ -159,19 +159,13 @@ func (s *Server) RemoveChainLocalOverride(_ context.Context, req *control.Remove
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
removed := true
|
|
||||||
if err = s.localOverrideStorage.LocalStorage().RemoveOverride(apechain.Ingress, target, apechain.ID(req.GetBody().GetChainId())); err != nil {
|
if err = s.localOverrideStorage.LocalStorage().RemoveOverride(apechain.Ingress, target, apechain.ID(req.GetBody().GetChainId())); err != nil {
|
||||||
code := getCodeByLocalStorageErr(err)
|
if code := getCodeByLocalStorageErr(err); code != codes.NotFound {
|
||||||
if code == codes.NotFound {
|
|
||||||
removed = false
|
|
||||||
} else {
|
|
||||||
return nil, status.Error(code, err.Error())
|
return nil, status.Error(code, err.Error())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
resp := &control.RemoveChainLocalOverrideResponse{
|
resp := &control.RemoveChainLocalOverrideResponse{
|
||||||
Body: &control.RemoveChainLocalOverrideResponse_Body{
|
Body: &control.RemoveChainLocalOverrideResponse_Body{},
|
||||||
Removed: removed,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
err = SignMessage(s.key, resp)
|
err = SignMessage(s.key, resp)
|
||||||
fyrchik
commented
Do we need this in control service at all? Do we need this in control service at all?
aarifullin
commented
Alright. It seems Alright. It seems `Removed` is really confusing flag. I have removed it `proto`, regenerated protobufs and fix control API and cli!
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
BIN
pkg/services/control/service.pb.go
generated
BIN
pkg/services/control/service.pb.go
generated
Binary file not shown.
|
@ -566,7 +566,6 @@ message RemoveChainLocalOverrideRequest {
|
||||||
|
|
||||||
message RemoveChainLocalOverrideResponse {
|
message RemoveChainLocalOverrideResponse {
|
||||||
message Body {
|
message Body {
|
||||||
bool removed = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Body body = 1;
|
Body body = 1;
|
||||||
|
|
BIN
pkg/services/control/service_frostfs.pb.go
generated
BIN
pkg/services/control/service_frostfs.pb.go
generated
Binary file not shown.
Loading…
Reference in a new issue
So what do we need
remove
flag for if it is always true?You're right. I have removed
remove
flag. Butremoved
in the response body is left as a first implementation flavor, because we agreed about to return success even a chain is not found after control API had introducedRemove
methodI don't understand, what is the reason to have field in the body which is always true?
Is someone already dependent on it?