diff --git a/cmd/frostfs-adm/internal/modules/morph/container.go b/cmd/frostfs-adm/internal/modules/morph/container.go index 9bc6cae41c..b5447fcfe7 100644 --- a/cmd/frostfs-adm/internal/modules/morph/container.go +++ b/cmd/frostfs-adm/internal/modules/morph/container.go @@ -42,15 +42,27 @@ func getContainerContractHash(cmd *cobra.Command, inv *invoker.Invoker, c Client } func getContainersList(inv *invoker.Invoker, ch util.Uint160) ([][]byte, error) { - res, err := inv.Call(ch, "list", "") + sid, r, err := unwrap.SessionIterator(inv.Call(ch, "containersOf", "")) if err != nil { return nil, fmt.Errorf("%w: %v", errInvalidContainerResponse, err) } - itm, err := unwrap.Item(res, err) - if _, ok := itm.(stackitem.Null); !ok { - return unwrap.ArrayOfBytes(res, err) + // Nothing bad, except live session on the server, do not report to the user. + defer func() { _ = inv.TerminateSession(sid) }() + + var lst [][]byte + + items, err := inv.TraverseIterator(sid, &r, 0) + for err == nil && len(items) != 0 { + for j := range items { + b, err := items[j].TryBytes() + if err != nil { + return nil, fmt.Errorf("%w: %v", errInvalidContainerResponse, err) + } + lst = append(lst, b) + } + items, err = inv.TraverseIterator(sid, &r, 0) } - return nil, nil + return lst, err } func dumpContainers(cmd *cobra.Command, _ []string) error {