forked from TrueCloudLab/frostfs-node
[#932] adm: Move `dump-hashes` to package `contract`
Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>bugfix/namespace_require
parent
9b65f1595a
commit
e2557b2f0b
|
@ -1,4 +1,4 @@
|
||||||
package morph
|
package contract
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
@ -45,7 +45,7 @@ func dumpContractHashes(cmd *cobra.Command, _ []string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
zone, _ := cmd.Flags().GetString(customZoneFlag)
|
zone, _ := cmd.Flags().GetString(morphUtil.CustomZoneFlag)
|
||||||
if zone != "" {
|
if zone != "" {
|
||||||
return dumpCustomZoneHashes(cmd, cs.Hash, zone, c)
|
return dumpCustomZoneHashes(cmd, cs.Hash, zone, c)
|
||||||
}
|
}
|
|
@ -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 (
|
const (
|
||||||
contractPathFlag = "contract"
|
contractPathFlag = "contract"
|
||||||
updateFlag = "update"
|
updateFlag = "update"
|
||||||
customZoneFlag = "domain"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var deployCmd = &cobra.Command{
|
var deployCmd = &cobra.Command{
|
||||||
|
@ -55,7 +54,7 @@ func init() {
|
||||||
_ = deployCmd.MarkFlagFilename(contractPathFlag)
|
_ = deployCmd.MarkFlagFilename(contractPathFlag)
|
||||||
|
|
||||||
ff.Bool(updateFlag, false, "Update an existing contract")
|
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 {
|
func deployContractCmd(cmd *cobra.Command, args []string) error {
|
||||||
|
@ -85,7 +84,7 @@ func deployContractCmd(cmd *cobra.Command, args []string) error {
|
||||||
|
|
||||||
callHash := management.Hash
|
callHash := management.Hash
|
||||||
method := deployMethodName
|
method := deployMethodName
|
||||||
zone, _ := cmd.Flags().GetString(customZoneFlag)
|
zone, _ := cmd.Flags().GetString(util.CustomZoneFlag)
|
||||||
domain := ctrName + "." + zone
|
domain := ctrName + "." + zone
|
||||||
isUpdate, _ := cmd.Flags().GetBool(updateFlag)
|
isUpdate, _ := cmd.Flags().GetBool(updateFlag)
|
||||||
if isUpdate {
|
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/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/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/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/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/netmap"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/node"
|
"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{
|
updateContractsCmd = &cobra.Command{
|
||||||
Use: "update-contracts",
|
Use: "update-contracts",
|
||||||
Short: "Update FrostFS contracts",
|
Short: "Update FrostFS contracts",
|
||||||
|
@ -127,7 +119,7 @@ func init() {
|
||||||
RootCmd.AddCommand(node.RemoveCmd)
|
RootCmd.AddCommand(node.RemoveCmd)
|
||||||
RootCmd.AddCommand(policy.Set)
|
RootCmd.AddCommand(policy.Set)
|
||||||
RootCmd.AddCommand(policy.Dump)
|
RootCmd.AddCommand(policy.Dump)
|
||||||
initDumpContractHashesCmd()
|
RootCmd.AddCommand(contract.DumpHashesCmd)
|
||||||
RootCmd.AddCommand(config.SetCmd)
|
RootCmd.AddCommand(config.SetCmd)
|
||||||
RootCmd.AddCommand(config.DumpCmd)
|
RootCmd.AddCommand(config.DumpCmd)
|
||||||
RootCmd.AddCommand(balance.DumpCmd)
|
RootCmd.AddCommand(balance.DumpCmd)
|
||||||
|
@ -165,12 +157,6 @@ func initUpdateContractsCmd() {
|
||||||
updateContractsCmd.MarkFlagsMutuallyExclusive(util.ContractsInitFlag, util.ContractsURLFlag)
|
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() {
|
func initGenerateStorageCmd() {
|
||||||
RootCmd.AddCommand(generateStorageCmd)
|
RootCmd.AddCommand(generateStorageCmd)
|
||||||
generateStorageCmd.Flags().String(util.AlphabetWalletsFlag, "", util.AlphabetWalletsFlagDesc)
|
generateStorageCmd.Flags().String(util.AlphabetWalletsFlag, "", util.AlphabetWalletsFlagDesc)
|
||||||
|
|
|
@ -31,6 +31,7 @@ const (
|
||||||
WithdrawFeeInitFlag = "network.fee.withdraw"
|
WithdrawFeeInitFlag = "network.fee.withdraw"
|
||||||
MaintenanceModeAllowedInitFlag = "network.maintenance_mode_allowed"
|
MaintenanceModeAllowedInitFlag = "network.maintenance_mode_allowed"
|
||||||
HomomorphicHashDisabledInitFlag = "network.homomorphic_hash_disabled"
|
HomomorphicHashDisabledInitFlag = "network.homomorphic_hash_disabled"
|
||||||
|
CustomZoneFlag = "domain"
|
||||||
|
|
||||||
SingleAccountName = "single"
|
SingleAccountName = "single"
|
||||||
CommitteeAccountName = "committee"
|
CommitteeAccountName = "committee"
|
||||||
|
|
Loading…
Reference in New Issue