[#1159] adm: Remove wallet requirement for list-namespace

Signed-off-by: Alexander Chuprov <a.chuprov@yadro.com>
This commit is contained in:
Alexander Chuprov 2024-06-17 15:01:33 +03:00
parent 512a2fa4ce
commit 81f1e48786

View file

@ -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 {