[#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:
parent
75a1a95c2c
commit
93bf9acbc2
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)
|
||||||
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