From 0168740c9af435aba8c13626d90080528199f004 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 25 Nov 2020 13:57:19 +0300 Subject: [PATCH] [#206] cli/container: Set default version of eACL table in set-eacl Set version of parsed eACL table to using SDK version if unsupported version was set in source data. Signed-off-by: Leonard Lyubich --- cmd/neofs-cli/modules/container.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmd/neofs-cli/modules/container.go b/cmd/neofs-cli/modules/container.go index 92b0a65ecc..188ecffa3c 100644 --- a/cmd/neofs-cli/modules/container.go +++ b/cmd/neofs-cli/modules/container.go @@ -13,6 +13,7 @@ import ( "time" "github.com/google/uuid" + "github.com/nspcc-dev/neofs-api-go/pkg" "github.com/nspcc-dev/neofs-api-go/pkg/acl" "github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl" "github.com/nspcc-dev/neofs-api-go/pkg/client" @@ -697,6 +698,11 @@ func parseEACL(eaclPath string) (*eacl.Table, error) { table := eacl.NewTable() if err = table.UnmarshalJSON(data); err == nil { + version := table.Version() + if err := pkg.IsSupportedVersion(&version); err != nil { + table.SetVersion(*pkg.SDKVersion()) + } + printVerbose("Parsed JSON encoded EACL table") return table, nil }