[#1978] cli: Add children to the static session on DELETE

If an external session is provided and is not opened by CLI itself, add
children objects to it too. It fixes "not found" errors when removing a big
object with a predefined session (from a file).

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
Pavel Karpy 2022-11-09 19:12:39 +03:00 committed by fyrchik
parent f48b1de54b
commit c85bea15ef

View file

@ -225,6 +225,12 @@ func ReadOrOpenSessionViaClient(cmd *cobra.Command, dst SessionPrm, cli *client.
var objs []oid.ID var objs []oid.ID
if obj != nil { if obj != nil {
objs = []oid.ID{*obj} objs = []oid.ID{*obj}
if _, ok := dst.(*internal.DeleteObjectPrm); ok {
common.PrintVerbose("Collecting relatives of the removal object...")
objs = append(objs, collectObjectRelatives(cmd, cli, cnr, *obj)...)
}
} }
finalizeSession(cmd, dst, tok, key, cnr, objs...) finalizeSession(cmd, dst, tok, key, cnr, objs...)