From 9690bd02aad0c767740890fd4b5d0f1ef82bed39 Mon Sep 17 00:00:00 2001 From: Anton Nikiforov Date: Thu, 1 Feb 2024 17:41:44 +0300 Subject: [PATCH] [#932] adm: Move `netmap-candidates` to package `netmap` Signed-off-by: Anton Nikiforov --- .../morph/{ => netmap}/netmap_candidates.go | 2 +- .../internal/modules/morph/netmap/root.go | 25 +++++++++++++++++++ .../internal/modules/morph/root.go | 18 ++----------- 3 files changed, 28 insertions(+), 17 deletions(-) rename cmd/frostfs-adm/internal/modules/morph/{ => netmap}/netmap_candidates.go (98%) create mode 100644 cmd/frostfs-adm/internal/modules/morph/netmap/root.go diff --git a/cmd/frostfs-adm/internal/modules/morph/netmap_candidates.go b/cmd/frostfs-adm/internal/modules/morph/netmap/netmap_candidates.go similarity index 98% rename from cmd/frostfs-adm/internal/modules/morph/netmap_candidates.go rename to cmd/frostfs-adm/internal/modules/morph/netmap/netmap_candidates.go index c09ba8b8..f105fe91 100644 --- a/cmd/frostfs-adm/internal/modules/morph/netmap_candidates.go +++ b/cmd/frostfs-adm/internal/modules/morph/netmap/netmap_candidates.go @@ -1,4 +1,4 @@ -package morph +package netmap import ( "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/commonflags" diff --git a/cmd/frostfs-adm/internal/modules/morph/netmap/root.go b/cmd/frostfs-adm/internal/modules/morph/netmap/root.go new file mode 100644 index 00000000..b8f9a61d --- /dev/null +++ b/cmd/frostfs-adm/internal/modules/morph/netmap/root.go @@ -0,0 +1,25 @@ +package netmap + +import ( + "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/util" + "github.com/spf13/cobra" + "github.com/spf13/viper" +) + +var CandidatesCmd = &cobra.Command{ + Use: "netmap-candidates", + Short: "List netmap candidates nodes", + PreRun: func(cmd *cobra.Command, _ []string) { + _ = viper.BindPFlag(util.EndpointFlag, cmd.Flags().Lookup(util.EndpointFlag)) + _ = viper.BindPFlag(util.AlphabetWalletsFlag, cmd.Flags().Lookup(util.AlphabetWalletsFlag)) + }, + Run: listNetmapCandidatesNodes, +} + +func initNetmapCandidatesCmd() { + CandidatesCmd.Flags().StringP(util.EndpointFlag, util.EndpointFlagShort, "", util.EndpointFlagDesc) +} + +func init() { + initNetmapCandidatesCmd() +} diff --git a/cmd/frostfs-adm/internal/modules/morph/root.go b/cmd/frostfs-adm/internal/modules/morph/root.go index 98e72fa5..908c4183 100644 --- a/cmd/frostfs-adm/internal/modules/morph/root.go +++ b/cmd/frostfs-adm/internal/modules/morph/root.go @@ -6,6 +6,7 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/config" "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/container" "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/frostfsid" + "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/netmap" "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/notary" "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/policy" "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/proxy" @@ -135,16 +136,6 @@ var ( }, RunE: updateContracts, } - - netmapCandidatesCmd = &cobra.Command{ - Use: "netmap-candidates", - Short: "List netmap candidates nodes", - PreRun: func(cmd *cobra.Command, _ []string) { - _ = viper.BindPFlag(util.EndpointFlag, cmd.Flags().Lookup(util.EndpointFlag)) - _ = viper.BindPFlag(util.AlphabetWalletsFlag, cmd.Flags().Lookup(util.AlphabetWalletsFlag)) - }, - Run: listNetmapCandidatesNodes, - } ) func init() { @@ -166,7 +157,7 @@ func init() { RootCmd.AddCommand(container.DumpCmd) initRefillGasCmd() RootCmd.AddCommand(notary.DepositCmd) - initNetmapCandidatesCmd() + RootCmd.AddCommand(netmap.CandidatesCmd) RootCmd.AddCommand(ape.Cmd) RootCmd.AddCommand(proxy.AddAccountCmd) @@ -175,11 +166,6 @@ func init() { RootCmd.AddCommand(frostfsid.Cmd) } -func initNetmapCandidatesCmd() { - RootCmd.AddCommand(netmapCandidatesCmd) - netmapCandidatesCmd.Flags().StringP(util.EndpointFlag, util.EndpointFlagShort, "", util.EndpointFlagDesc) -} - func initRefillGasCmd() { RootCmd.AddCommand(refillGasCmd) refillGasCmd.Flags().String(util.AlphabetWalletsFlag, "", util.AlphabetWalletsFlagDesc)