forked from TrueCloudLab/frostfs-node
[#932] adm: Move dump-hashes
to package contract
Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
This commit is contained in:
parent
9b65f1595a
commit
e2557b2f0b
5 changed files with 32 additions and 21 deletions
|
@ -1,4 +1,4 @@
|
|||
package morph
|
||||
package contract
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
|
@ -45,7 +45,7 @@ func dumpContractHashes(cmd *cobra.Command, _ []string) error {
|
|||
return err
|
||||
}
|
||||
|
||||
zone, _ := cmd.Flags().GetString(customZoneFlag)
|
||||
zone, _ := cmd.Flags().GetString(morphUtil.CustomZoneFlag)
|
||||
if zone != "" {
|
||||
return dumpCustomZoneHashes(cmd, cs.Hash, zone, c)
|
||||
}
|
25
cmd/frostfs-adm/internal/modules/morph/contract/root.go
Normal file
25
cmd/frostfs-adm/internal/modules/morph/contract/root.go
Normal file
|
@ -0,0 +1,25 @@
|
|||
package contract
|
||||
|
||||
import (
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/util"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
var DumpHashesCmd = &cobra.Command{
|
||||
Use: "dump-hashes",
|
||||
Short: "Dump deployed contract hashes",
|
||||
PreRun: func(cmd *cobra.Command, _ []string) {
|
||||
_ = viper.BindPFlag(util.EndpointFlag, cmd.Flags().Lookup(util.EndpointFlag))
|
||||
},
|
||||
RunE: dumpContractHashes,
|
||||
}
|
||||
|
||||
func initDumpContractHashesCmd() {
|
||||
DumpHashesCmd.Flags().StringP(util.EndpointFlag, util.EndpointFlagShort, "", util.EndpointFlagDesc)
|
||||
DumpHashesCmd.Flags().String(util.CustomZoneFlag, "", "Custom zone to search.")
|
||||
}
|
||||
|
||||
func init() {
|
||||
initDumpContractHashesCmd()
|
||||
}
|
|
@ -24,7 +24,6 @@ import (
|
|||
const (
|
||||
contractPathFlag = "contract"
|
||||
updateFlag = "update"
|
||||
customZoneFlag = "domain"
|
||||
)
|
||||
|
||||
var deployCmd = &cobra.Command{
|
||||
|
@ -55,7 +54,7 @@ func init() {
|
|||
_ = deployCmd.MarkFlagFilename(contractPathFlag)
|
||||
|
||||
ff.Bool(updateFlag, false, "Update an existing contract")
|
||||
ff.String(customZoneFlag, "frostfs", "Custom zone for NNS")
|
||||
ff.String(util.CustomZoneFlag, "frostfs", "Custom zone for NNS")
|
||||
}
|
||||
|
||||
func deployContractCmd(cmd *cobra.Command, args []string) error {
|
||||
|
@ -85,7 +84,7 @@ func deployContractCmd(cmd *cobra.Command, args []string) error {
|
|||
|
||||
callHash := management.Hash
|
||||
method := deployMethodName
|
||||
zone, _ := cmd.Flags().GetString(customZoneFlag)
|
||||
zone, _ := cmd.Flags().GetString(util.CustomZoneFlag)
|
||||
domain := ctrName + "." + zone
|
||||
isUpdate, _ := cmd.Flags().GetBool(updateFlag)
|
||||
if isUpdate {
|
||||
|
|
|
@ -5,6 +5,7 @@ import (
|
|||
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/balance"
|
||||
"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/contract"
|
||||
"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/node"
|
||||
|
@ -98,15 +99,6 @@ var (
|
|||
},
|
||||
}
|
||||
|
||||
dumpContractHashesCmd = &cobra.Command{
|
||||
Use: "dump-hashes",
|
||||
Short: "Dump deployed contract hashes",
|
||||
PreRun: func(cmd *cobra.Command, _ []string) {
|
||||
_ = viper.BindPFlag(util.EndpointFlag, cmd.Flags().Lookup(util.EndpointFlag))
|
||||
},
|
||||
RunE: dumpContractHashes,
|
||||
}
|
||||
|
||||
updateContractsCmd = &cobra.Command{
|
||||
Use: "update-contracts",
|
||||
Short: "Update FrostFS contracts",
|
||||
|
@ -127,7 +119,7 @@ func init() {
|
|||
RootCmd.AddCommand(node.RemoveCmd)
|
||||
RootCmd.AddCommand(policy.Set)
|
||||
RootCmd.AddCommand(policy.Dump)
|
||||
initDumpContractHashesCmd()
|
||||
RootCmd.AddCommand(contract.DumpHashesCmd)
|
||||
RootCmd.AddCommand(config.SetCmd)
|
||||
RootCmd.AddCommand(config.DumpCmd)
|
||||
RootCmd.AddCommand(balance.DumpCmd)
|
||||
|
@ -165,12 +157,6 @@ func initUpdateContractsCmd() {
|
|||
updateContractsCmd.MarkFlagsMutuallyExclusive(util.ContractsInitFlag, util.ContractsURLFlag)
|
||||
}
|
||||
|
||||
func initDumpContractHashesCmd() {
|
||||
RootCmd.AddCommand(dumpContractHashesCmd)
|
||||
dumpContractHashesCmd.Flags().StringP(util.EndpointFlag, util.EndpointFlagShort, "", util.EndpointFlagDesc)
|
||||
dumpContractHashesCmd.Flags().String(customZoneFlag, "", "Custom zone to search.")
|
||||
}
|
||||
|
||||
func initGenerateStorageCmd() {
|
||||
RootCmd.AddCommand(generateStorageCmd)
|
||||
generateStorageCmd.Flags().String(util.AlphabetWalletsFlag, "", util.AlphabetWalletsFlagDesc)
|
||||
|
|
|
@ -31,6 +31,7 @@ const (
|
|||
WithdrawFeeInitFlag = "network.fee.withdraw"
|
||||
MaintenanceModeAllowedInitFlag = "network.maintenance_mode_allowed"
|
||||
HomomorphicHashDisabledInitFlag = "network.homomorphic_hash_disabled"
|
||||
CustomZoneFlag = "domain"
|
||||
|
||||
SingleAccountName = "single"
|
||||
CommitteeAccountName = "committee"
|
||||
|
|
Loading…
Reference in a new issue