Skip to content

Commit

Permalink
Merge pull request #17 from Seagate/fix/locate-array
Browse files Browse the repository at this point in the history
Fix/locate array
  • Loading branch information
jskazinski authored Sep 16, 2022
2 parents 2435f86 + fc514dd commit dc348b9
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion kmip20/op_locate.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type LocateRequestPayload struct {
// Table 230

type LocateResponsePayload struct {
UniqueIdentifier string
UniqueIdentifier []string
}

type LocateHandler struct {
Expand Down
4 changes: 2 additions & 2 deletions op_locate.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ type LocateRequestPayload struct {
// Table 191

type LocateResponsePayload struct {
LocatedItems uint32 // Required: No
UniqueIdentifier string // Required: No
LocatedItems uint32 // Required: No
UniqueIdentifier []string // Required: No
}

type LocateHandler struct {
Expand Down
9 changes: 8 additions & 1 deletion src/kmipapi/kmip14.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,9 +301,16 @@ func (kmips *kmip14service) Locate(ctx context.Context, settings *ConfigurationS
return nil, fmt.Errorf("unable to decode GetResponsePayload, error: %v", err)
}

uid := respPayload.UniqueIdentifier
logger.V(4).Info("XXX Locate response payload", "respPayload", respPayload)

uids := respPayload.UniqueIdentifier
logger.V(4).Info("XXX Locate response payload", "uid", respPayload.UniqueIdentifier)

uid := ""
if len(uids) > 0 {
uid = uids[0]
}

return &LocateResponse{UniqueIdentifier: uid}, nil
}

Expand Down
7 changes: 6 additions & 1 deletion src/kmipapi/kmip20.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,9 +333,14 @@ func (kmips *kmip20service) Locate(ctx context.Context, settings *ConfigurationS
return nil, fmt.Errorf("unable to decode GetResponsePayload, error: %v", err)
}

uid := respPayload.UniqueIdentifier
uids := respPayload.UniqueIdentifier
logger.V(4).Info("XXX Locate response payload", "uid", respPayload.UniqueIdentifier)

uid := ""
if len(uids) > 0 {
uid = uids[0]
}

return &LocateResponse{UniqueIdentifier: uid}, nil
}

Expand Down

0 comments on commit dc348b9

Please sign in to comment.