forked from TrueCloudLab/frostfs-node
[#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:
parent
b4699b1e9f
commit
0168740c9a
1 changed files with 6 additions and 0 deletions
|
@ -13,6 +13,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"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"
|
||||||
"github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl"
|
"github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl"
|
||||||
"github.com/nspcc-dev/neofs-api-go/pkg/client"
|
"github.com/nspcc-dev/neofs-api-go/pkg/client"
|
||||||
|
@ -697,6 +698,11 @@ func parseEACL(eaclPath string) (*eacl.Table, error) {
|
||||||
|
|
||||||
table := eacl.NewTable()
|
table := eacl.NewTable()
|
||||||
if err = table.UnmarshalJSON(data); err == nil {
|
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")
|
printVerbose("Parsed JSON encoded EACL table")
|
||||||
return table, nil
|
return table, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue