[#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 <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2020-11-25 13:57:19 +03:00 committed by Leonard Lyubich
parent b4699b1e9f
commit 0168740c9a

View file

@ -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
}