[#409] authmate: Fix container ID parsing

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2022-04-28 17:21:56 +03:00 committed by Kira
parent 58ce884eab
commit c9126fc0a9

View file

@ -245,8 +245,9 @@ It will be ceil rounded to the nearest amount of epoch.`,
}
agent := authmate.New(log, neoFS)
var containerID cid.ID
var containerID *cid.ID // keep nil value if container flag is not set
if len(containerIDFlag) > 0 {
containerID = new(cid.ID)
if err = containerID.DecodeString(containerIDFlag); err != nil {
return cli.Exit(fmt.Sprintf("failed to parse auth container id: %s", err), 3)
}
@ -282,7 +283,7 @@ It will be ceil rounded to the nearest amount of epoch.`,
issueSecretOptions := &authmate.IssueSecretOptions{
Container: authmate.ContainerOptions{
ID: &containerID,
ID: containerID,
FriendlyName: containerFriendlyName,
PlacementPolicy: containerPlacementPolicy,
},