Skip to content

Commit

Permalink
neofs-cli/container: make --name set __NEOFS__NAME attribute
Browse files Browse the repository at this point in the history
Attribute `--name` now set `Name` attribute and `__NEOFS__NAME` attribute, which
is used for container domain name in NNS contracts.

Closes #2682.

Signed-off-by: Andrey Butusov <andrey@nspcc.io>
  • Loading branch information
End-rey committed Sep 24, 2024
1 parent ca16d59 commit f0c9ce3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ Changelog for NeoFS Node
### Changed
- `ObjectService`'s `Put` RPC handler caches up to 10K lists of per-object sorted container nodes (#2901)
- Metabase graveyard scheme (#2929)
- For `neofs-cli container create`, flag `--name` set `Name` attribute and `__NEOFS__NAME` attribute, which
is used for container domain name in NNS contracts (#2950)

### Removed

Expand Down
6 changes: 5 additions & 1 deletion cmd/neofs-cli/modules/container/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,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 in NNS contract")

Check warning on line 160 in cmd/neofs-cli/modules/container/create.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-cli/modules/container/create.go#L160

Added line #L160 was not covered by tests
flags.BoolVar(&containerNoTimestamp, "disable-timestamp", false, "Disable timestamp container attribute")
flags.BoolVarP(&force, commonflags.ForceFlag, commonflags.ForceFlagShorthand, false,
"Skip placement validity check")
Expand Down Expand Up @@ -208,6 +208,10 @@ func parseAttributes(dst *container.Container, attributes []string) error {

if containerName != "" {
dst.SetName(containerName)

var d container.Domain
d.SetName(containerName)
dst.WriteDomain(d)

Check warning on line 214 in cmd/neofs-cli/modules/container/create.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-cli/modules/container/create.go#L212-L214

Added lines #L212 - L214 were not covered by tests
}

return nil
Expand Down

0 comments on commit f0c9ce3

Please sign in to comment.