Skip to content
Snippets Groups Projects
Commit ce6e55c2 authored by Olgun Cengiz's avatar Olgun Cengiz :drum:
Browse files

debug device log

parent 3aab4ce6
No related branches found
No related tags found
2 merge requests!48Master,!4716 refactor deprecated functions
......@@ -23,6 +23,7 @@ import (
"code.vereign.com/code/viam-apis/key-storage-agent/api"
"code.vereign.com/code/viam-apis/utils"
"golang.org/x/net/context"
"log"
)
func (s *KeyStorageServerImpl) SetAuthorized(ctx context.Context, in *api.SetAuthorizedRequest) (*api.SetAuthorizedResponse, error) {
......@@ -109,13 +110,18 @@ func (s *KeyStorageServerImpl) updateAll(ctx context.Context, uuid string, updat
func updateKey(client *client.DataStorageClientImpl, uuid string, keyType api.KeyType, update func(*api.Key)) []*api.Status {
key, statusList := keyutils.GetKey(client, uuid, keyType)
log.Printf("OC-16 key: %v", key)
log.Printf("OC-16 statusList: %v", statusList)
if statusList != nil {
return statusList
}
update(key)
log.Printf("OC-16 key: %v", key)
_, errors, err := client.PutData("keys", uuid+"/"+api.KeyType.String(keyType), key)
log.Printf("OC-16 errors: %v", errors)
log.Printf("OC-16 err: %v", err)
statusList = keyutils.HandlePutDataErrors(statusList, errors, err)
if statusList != nil && len(statusList) > 0 {
return statusList
......
......@@ -139,6 +139,9 @@ func GetKey(client *client.DataStorageClientImpl, uuid string, keyType api.KeyTy
key := &api.Key{}
hasData, errorsString, err := client.GetData("keys", uuid+"/"+api.KeyType.String(keyType), key)
log.Printf("OC-16 hasData: %v", hasData)
log.Printf("OC-16 errorsString: %v", errorsString)
log.Printf("OC-16 err: %v", err)
if err != nil {
statusList = utils.AddStatus(statusList, "400", api.StatusType_ERROR, errorsString)
return nil, statusList
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment