You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by ma...@apache.org on 2021/11/18 16:57:10 UTC

[trafficcontrol] branch master updated: Handle - correctly, warn on dangling object (#6353)

This is an automated email from the ASF dual-hosted git repository.

mattjackson pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git


The following commit(s) were added to refs/heads/master by this push:
     new 9cf2677  Handle - correctly, warn on dangling object (#6353)
9cf2677 is described below

commit 9cf2677bda448321d2d671dc0ea14fdfa4eb4bea
Author: Steve Hamrick <sh...@users.noreply.github.com>
AuthorDate: Thu Nov 18 09:56:49 2021 -0700

    Handle - correctly, warn on dangling object (#6353)
    
    Co-authored-by: Steve Hamrick <st...@comcast.com>
---
 traffic_ops/app/db/traffic_vault_migrate/riak.go | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/traffic_ops/app/db/traffic_vault_migrate/riak.go b/traffic_ops/app/db/traffic_vault_migrate/riak.go
index c26febf..35e43a2 100644
--- a/traffic_ops/app/db/traffic_vault_migrate/riak.go
+++ b/traffic_ops/app/db/traffic_vault_migrate/riak.go
@@ -29,6 +29,7 @@ import (
 
 	"github.com/basho/riak-go-client"
 
+	"github.com/apache/trafficcontrol/lib/go-log"
 	"github.com/apache/trafficcontrol/lib/go-rfc"
 	"github.com/apache/trafficcontrol/lib/go-tc"
 )
@@ -281,7 +282,7 @@ func (tbl *riakSSLKeyTable) gatherKeys(cluster *riak.Cluster, timeout int) error
 		}
 		tbl.Records[i] = riakSSLKeyRecord{
 			DeliveryServiceSSLKeys: obj,
-			Version:                strings.Split(objs[0].Key, "-")[1],
+			Version:                objs[0].Key[strings.LastIndex(objs[0].Key, "-")+1:],
 		}
 	}
 	return nil
@@ -574,7 +575,9 @@ func getObjects(cluster *riak.Cluster, bucket string, timeout int) ([]*riak.Obje
 		if err != nil {
 			return nil, err
 		}
-		if len(objects) > 1 {
+		if len(objects) == 0 {
+			continue
+		} else if len(objects) > 1 {
 			return nil, fmt.Errorf("Unexpected number of objects %d\n", len(objects))
 		}
 
@@ -601,7 +604,7 @@ func getObject(cluster *riak.Cluster, bucket string, key string, timeout int) ([
 	rsp := fvc.Response
 
 	if rsp.IsNotFound {
-		return nil, fmt.Errorf("errors executing riak fetch value command; key not found: %s:%s", bucket, key)
+		log.Warnf("got no object for bucket: %v, key: %v\n", bucket, key)
 	}
 
 	return rsp.Values, nil