forked from TrueCloudLab/frostfs-node
[#1159] adm: Remove wallet requirement for list-namespace
Signed-off-by: Alexander Chuprov <a.chuprov@yadro.com>
This commit is contained in:
parent
512a2fa4ce
commit
81f1e48786
1 changed files with 13 additions and 4 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Reference in a new issue