[#898] control: Remove removed flag from RemoveChainLocalOverrideResponse

* Remove removed flag in service.proto for RemoveChainLocalOverrideResponse.
* Regenerate control API.
* Return error only if RemoveOverride returns non-NotFound code.

Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
This commit is contained in:
Airat Arifullin 2024-02-27 12:27:09 +03:00 committed by Evgenii Stratonikov
parent 75a1a95c2c
commit 93bf9acbc2
5 changed files with 3 additions and 14 deletions

View file

@ -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() {

View file

@ -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)
if err != nil { if err != nil {

Binary file not shown.

View file

@ -566,7 +566,6 @@ message RemoveChainLocalOverrideRequest {
message RemoveChainLocalOverrideResponse { message RemoveChainLocalOverrideResponse {
message Body { message Body {
bool removed = 1;
} }
Body body = 1; Body body = 1;

Binary file not shown.