You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by da...@apache.org on 2018/07/12 23:23:10 UTC

[trafficcontrol] branch master updated: Fix DSR PUT handlers for status/assignments

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

dangogh 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 6a032b3  Fix DSR PUT handlers for status/assignments
6a032b3 is described below

commit 6a032b3d9555f19a9e001e3531fb2972bca3c5a7
Author: Rawlin Peters <ra...@comcast.com>
AuthorDate: Wed Jul 11 16:24:44 2018 -0600

    Fix DSR PUT handlers for status/assignments
    
    Rather than reassigning the entire struct (which now causes the
    recently-added ReqInfo to be lost), just overwrite the embedded
    DSRNullable struct with the current DSR from the DB.
---
 traffic_ops/traffic_ops_golang/deliveryservice/request/requests.go | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/traffic_ops/traffic_ops_golang/deliveryservice/request/requests.go b/traffic_ops/traffic_ops_golang/deliveryservice/request/requests.go
index 78c4546..dbff2e1 100644
--- a/traffic_ops/traffic_ops_golang/deliveryservice/request/requests.go
+++ b/traffic_ops/traffic_ops_golang/deliveryservice/request/requests.go
@@ -486,7 +486,7 @@ func (req *deliveryServiceRequestAssignment) Update() (error, tc.ApiErrorType) {
 
 	// Only assigneeID changes -- nothing else
 	assigneeID := req.AssigneeID
-	*req = deliveryServiceRequestAssignment{current}
+	req.DeliveryServiceRequestNullable = current.DeliveryServiceRequestNullable
 	req.AssigneeID = assigneeID
 
 	// LastEditedBy field should not change with status update
@@ -557,7 +557,7 @@ func (req *deliveryServiceRequestStatus) Update() (error, tc.ApiErrorType) {
 	// get original
 	var current TODeliveryServiceRequest
 	if req.ID == nil {
-		log.Errorf("error updating DeliveryServiceRequestStatus: ID is nil")
+		return errors.New("error updating DeliveryServiceRequestStatus: ID is nil"), tc.SystemError
 	}
 	err := req.ReqInfo.Tx.QueryRowx(selectDeliveryServiceRequestsQuery() + ` WHERE r.id=` + strconv.Itoa(*req.ID)).StructScan(&current)
 	if err != nil {
@@ -571,7 +571,7 @@ func (req *deliveryServiceRequestStatus) Update() (error, tc.ApiErrorType) {
 
 	// keep everything else the same -- only update status
 	st := req.Status
-	*req = deliveryServiceRequestStatus{current}
+	req.DeliveryServiceRequestNullable = current.DeliveryServiceRequestNullable
 	req.Status = st
 
 	// LastEditedBy field should not change with status update