Some checks failed
Tests and linters / Run gofumpt (pull_request) Successful in 3m21s
Pre-commit hooks / Pre-commit (pull_request) Successful in 4m10s
Tests and linters / Tests (pull_request) Successful in 4m16s
DCO action / DCO (pull_request) Failing after 4m29s
Vulncheck / Vulncheck (pull_request) Successful in 5m44s
Tests and linters / Tests with -race (pull_request) Successful in 6m13s
Build / Build Components (pull_request) Successful in 6m23s
Tests and linters / Staticcheck (pull_request) Successful in 6m25s
Tests and linters / gopls check (pull_request) Successful in 6m27s
Tests and linters / Lint (pull_request) Successful in 7m27s
Currently, we allow using `--local-dump` in `morph init` command. We also have this flag in other commands, but no `--protocol` which is also needed. And in new command we do not have the ability to use local dump at all. This commit makes it possible to work either with an RPC or with local-dump in every command. Refs #1035. Refs TrueCloudLab/frostfs-dev-env#42. Writing gopatch this time was really satisfying, btw: ``` @@ var flags expression @@ -flags.StringP(commonflags.EndpointFlag, ...) +commonflags.InitRPC(flags) @@ var flags expression @@ -_ = viper.BindPFlag(commonflags.EndpointFlag, flags.Lookup(...)) +commonflags.BindRPC(flags) ``` Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
50 lines
2.2 KiB
Go
50 lines
2.2 KiB
Go
package nns
|
|
|
|
import (
|
|
"math/big"
|
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/commonflags"
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/constants"
|
|
commonCmd "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/internal/common"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func initUpdateCmd() {
|
|
Cmd.AddCommand(updateCmd)
|
|
commonflags.InitRPC(updateCmd.Flags())
|
|
updateCmd.Flags().String(commonflags.AlphabetWalletsFlag, "", commonflags.AlphabetWalletsFlagDesc)
|
|
updateCmd.Flags().String(nnsNameFlag, "", nnsNameFlagDesc)
|
|
updateCmd.Flags().String(nnsEmailFlag, constants.FrostfsOpsEmail, "Domain owner email")
|
|
updateCmd.Flags().Int64(nnsRefreshFlag, constants.NNSRefreshDefVal,
|
|
"The number of seconds between update requests from secondary and slave name servers")
|
|
updateCmd.Flags().Int64(nnsRetryFlag, constants.NNSRetryDefVal,
|
|
"The number of seconds the secondary or slave will wait before retrying when the last attempt has failed")
|
|
updateCmd.Flags().Int64(nnsExpireFlag, int64(constants.DefaultExpirationTime),
|
|
"The number of seconds a master or slave will wait before considering the data stale "+
|
|
"if it cannot reach the primary name server")
|
|
updateCmd.Flags().Int64(nnsTTLFlag, constants.NNSTtlDefVal,
|
|
"The number of seconds a domain name is cached locally before expiration and return to authoritative "+
|
|
"nameservers for updated information")
|
|
|
|
_ = cobra.MarkFlagRequired(updateCmd.Flags(), nnsNameFlag)
|
|
}
|
|
|
|
func updateSOA(cmd *cobra.Command, _ []string) {
|
|
c, actor, _ := getRPCClient(cmd)
|
|
|
|
name, _ := cmd.Flags().GetString(nnsNameFlag)
|
|
email, _ := cmd.Flags().GetString(nnsEmailFlag)
|
|
refresh, _ := cmd.Flags().GetInt64(nnsRefreshFlag)
|
|
retry, _ := cmd.Flags().GetInt64(nnsRetryFlag)
|
|
expire, _ := cmd.Flags().GetInt64(nnsExpireFlag)
|
|
ttl, _ := cmd.Flags().GetInt64(nnsTTLFlag)
|
|
|
|
h, vub, err := c.UpdateSOA(name, email, big.NewInt(refresh),
|
|
big.NewInt(retry), big.NewInt(expire), big.NewInt(ttl))
|
|
commonCmd.ExitOnErr(cmd, "unable to send transaction: %w", err)
|
|
|
|
cmd.Println("Waiting for transaction to persist...")
|
|
_, err = actor.Wait(h, vub, err)
|
|
commonCmd.ExitOnErr(cmd, "register domain error: %w", err)
|
|
cmd.Println("SOA records updated successfully")
|
|
}
|