Compare commits

...

1 commit

Author SHA1 Message Date
e249c95844 [#824] frostfs-cli: Support passing chain ID in add-rule command
All checks were successful
DCO action / DCO (pull_request) Successful in 4m43s
Vulncheck / Vulncheck (pull_request) Successful in 5m30s
Build / Build Components (1.20) (pull_request) Successful in 6m28s
Build / Build Components (1.21) (pull_request) Successful in 6m32s
Tests and linters / Staticcheck (pull_request) Successful in 6m31s
Tests and linters / Tests (1.20) (pull_request) Successful in 6m58s
Tests and linters / Lint (pull_request) Successful in 7m27s
Tests and linters / Tests (1.21) (pull_request) Successful in 7m49s
Tests and linters / Tests with -race (pull_request) Successful in 9m44s
Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
2023-11-21 17:04:41 +03:00

View file

@ -41,6 +41,8 @@ func prettyJSONFormat(cmd *cobra.Command, serializedChain []byte) string {
func addRule(cmd *cobra.Command, _ []string) {
pk := key.Get(cmd)
chainID, _ := cmd.Flags().GetString(chainIDFlag)
var cnr cid.ID
cidStr, _ := cmd.Flags().GetString(commonflags.CIDFlag)
commonCmd.ExitOnErr(cmd, "can't decode container ID: %w", cnr.DecodeString(cidStr))
@ -52,6 +54,7 @@ func addRule(cmd *cobra.Command, _ []string) {
chain := new(apechain.Chain)
commonCmd.ExitOnErr(cmd, "parser error: %w", util.ParseAPEChain(chain, []string{rule}))
chain.ID = apechain.ID(chainID)
serializedChain := chain.Bytes()
cmd.Println("Container ID: " + cidStr)
@ -87,4 +90,5 @@ func initControlAddRuleCmd() {
ff := addRuleCmd.Flags()
ff.String(commonflags.CIDFlag, "", commonflags.CIDFlagUsage)
ff.String(ruleFlag, "", "Rule statement")
ff.String(chainIDFlag, "", "Assign ID to the parsed chain")
}