forked from TrueCloudLab/frostfs-node
[#1351] apemanager: Fix AddChain
handler for audit middleware
* `GetChainID` from `frostfs-api-go/v2` does not handler nil-pointer response body that leads to the panic after its call. Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
This commit is contained in:
parent
43d6fbf73b
commit
eec359cfa8
1 changed files with 6 additions and 1 deletions
|
@ -33,10 +33,15 @@ func (a *auditService) AddChain(ctx context.Context, req *apemanager.AddChainReq
|
|||
return res, err
|
||||
}
|
||||
|
||||
var respChainID []byte
|
||||
if respBody := res.GetBody(); respBody != nil {
|
||||
respChainID = respBody.GetChainID()
|
||||
}
|
||||
|
||||
audit.LogRequest(a.log, ape_grpc.APEManagerService_AddChain_FullMethodName, req,
|
||||
audit.TargetFromChainID(req.GetBody().GetTarget().GetTargetType().String(),
|
||||
req.GetBody().GetTarget().GetName(),
|
||||
res.GetBody().GetChainID()),
|
||||
respChainID),
|
||||
err == nil)
|
||||
|
||||
return res, err
|
||||
|
|
Loading…
Reference in a new issue