diff --git a/cmd/frostfs-adm/internal/modules/morph/frostfsid/frostfsid.go b/cmd/frostfs-adm/internal/modules/morph/frostfsid/frostfsid.go index 855b6931..de432aec 100644 --- a/cmd/frostfs-adm/internal/modules/morph/frostfsid/frostfsid.go +++ b/cmd/frostfs-adm/internal/modules/morph/frostfsid/frostfsid.go @@ -253,12 +253,21 @@ func frostfsidCreateNamespace(cmd *cobra.Command, _ []string) { } func frostfsidListNamespaces(cmd *cobra.Command, _ []string) { - ffsid, err := newFrostfsIDClient(cmd) - commonCmd.ExitOnErr(cmd, "init contract invoker: %w", err) + c, err := helper.GetN3Client(viper.GetViper()) + commonCmd.ExitOnErr(cmd, "can't create N3 client: %w", err) - namespaces, err := ffsid.roCli.ListNamespaces() + inv := invoker.New(c, nil) + r := management.NewReader(inv) + + cs, err := r.GetContractByID(1) + commonCmd.ExitOnErr(cmd, "can't get NNS contract info: %w", err) + + nmHash, err := helper.NNSResolveHash(inv, cs.Hash, helper.DomainOf(constants.FrostfsIDContract)) + commonCmd.ExitOnErr(cmd, "can't get netmap contract hash: %w", err) + + item, err := commonclient.ReadIteratorItems(inv, 100, nmHash, "listNamespaces") commonCmd.ExitOnErr(cmd, "list namespaces: %w", err) - + namespaces, _ := frostfsidclient.ParseNamespaces(item) sort.Slice(namespaces, func(i, j int) bool { return namespaces[i].Name < namespaces[j].Name }) for _, namespace := range namespaces {