mitchell852 closed pull request #2562: Fix DS servers ReplaceHandler
URL: https://github.com/apache/trafficcontrol/pull/2562
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/lib/go-tc/deliveryservices.go b/lib/go-tc/deliveryservices.go
index d0429e71e..1a5d1e4fa 100644
--- a/lib/go-tc/deliveryservices.go
+++ b/lib/go-tc/deliveryservices.go
@@ -586,7 +586,7 @@ type UserDeliveryServicesResponse struct {
 }
 
 type DSServerIDs struct {
-       DeliveryServiceID *int  `json:"dsId", db:"deliveryservice"`
+       DeliveryServiceID *int  `json:"dsId" db:"deliveryservice"`
        ServerIDs         []int `json:"servers"`
        Replace           *bool `json:"replace"`
 }
diff --git a/traffic_ops/testing/api/v13/todb.go 
b/traffic_ops/testing/api/v13/todb.go
index 6936194c6..3761adab6 100644
--- a/traffic_ops/testing/api/v13/todb.go
+++ b/traffic_ops/testing/api/v13/todb.go
@@ -239,6 +239,7 @@ func Teardown(db *sql.DB) error {
        DELETE FROM regex;
        DELETE FROM deliveryservice_server;
        DELETE FROM deliveryservice;
+       DELETE FROM origin;
        DELETE FROM server;
        DELETE FROM phys_location;
        DELETE FROM region;
@@ -247,6 +248,7 @@ func Teardown(db *sql.DB) error {
        DELETE FROM parameter;
        DELETE FROM profile_parameter;
        DELETE FROM cachegroup;
+       DELETE FROM coordinate;
        DELETE FROM type;
        DELETE FROM status;
        DELETE FROM snapshot;
diff --git a/traffic_ops/traffic_ops_golang/deliveryservice/servers/servers.go 
b/traffic_ops/traffic_ops_golang/deliveryservice/servers/servers.go
index 748ceaed3..5f6977e11 100644
--- a/traffic_ops/traffic_ops_golang/deliveryservice/servers/servers.go
+++ b/traffic_ops/traffic_ops_golang/deliveryservice/servers/servers.go
@@ -368,14 +368,12 @@ func GetReplaceHandler(db *sqlx.DB) http.HandlerFunc {
 
                if *payload.Replace {
                        // delete existing
-                       rows, err := tx.Queryx("DELETE FROM 
deliveryservice_server WHERE deliveryservice = $1", *dsId)
+                       _, err := tx.Exec("DELETE FROM deliveryservice_server 
WHERE deliveryservice = $1", *dsId)
                        if err != nil {
                                log.Errorf("unable to remove the existing 
servers assigned to the delivery service: %s", err)
                                handleErrs(http.StatusInternalServerError, err)
                                return
                        }
-
-                       defer rows.Close()
                }
 
                i := 0


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to