From 63453141ee2e798d5b3f5b21b8e0ae6eb5e6fa12 Mon Sep 17 00:00:00 2001 From: Andrey Butusov Date: Tue, 24 Sep 2024 17:06:45 +0300 Subject: [PATCH] neofs-cli/container: make `--name` set `__NEOFS__NAME` attribute Flag `--name` now sets also `__NEOFS__NAME` attribute, which is used for container domain name in NNS contracts. Closes #2682. Signed-off-by: Andrey Butusov --- CHANGELOG.md | 3 ++- cmd/neofs-cli/modules/container/create.go | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 32d595491b..55f4177b03 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,12 +11,13 @@ Changelog for NeoFS Node ### Fixed - Do not search for tombstones when handling their expiration, use local indexes instead (#2929) -- `defer` func is not skipped in cobra-based programs (#2942) ### Changed - `ObjectService`'s `Put` RPC handler caches up to 10K lists of per-object sorted container nodes (#2901) - Metabase graveyard scheme (#2929) - When an error is returned, no additional help output is displayed in cobra-based programs (#2942) +- For `neofs-cli container create`, `--name` flag sets also `__NEOFS__NAME` attribute, which + is used for container domain name in NNS contracts (#2950) ### Removed diff --git a/cmd/neofs-cli/modules/container/create.go b/cmd/neofs-cli/modules/container/create.go index 3c81418887..2a9505b851 100644 --- a/cmd/neofs-cli/modules/container/create.go +++ b/cmd/neofs-cli/modules/container/create.go @@ -181,7 +181,7 @@ func initContainerCreateCmd() { flags.StringSliceVarP(&containerAttributes, "attributes", "a", nil, "Comma separated pairs of container attributes in form of Key1=Value1,Key2=Value2") flags.BoolVar(&containerAwait, "await", false, fmt.Sprintf("Block execution until container is persisted. "+ "Increases default execution timeout to %.0fs", awaitTimeout.Seconds())) // simple %s notation prints 1m0s https://github.com/golang/go/issues/39064 - flags.StringVar(&containerName, "name", "", "Container name attribute") + flags.StringVar(&containerName, "name", "", "Container name attribute and domain name attribute, that is registered with the default zone in NNS contract") flags.BoolVar(&containerNoTimestamp, "disable-timestamp", false, "Disable timestamp container attribute") flags.BoolVarP(&force, commonflags.ForceFlag, commonflags.ForceFlagShorthand, false, "Skip placement validity check") @@ -232,6 +232,10 @@ func parseAttributes(dst *container.Container, attributes []string) error { if containerName != "" { dst.SetName(containerName) + + var d container.Domain + d.SetName(containerName) + dst.WriteDomain(d) } return nil