You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by dg...@apache.org on 2018/04/23 20:13:53 UTC

[incubator-trafficcontrol] branch master updated: added json response field use_reval_pending to update_status endpoint

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

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


The following commit(s) were added to refs/heads/master by this push:
     new a03b8ca  added json response field use_reval_pending to update_status endpoint
a03b8ca is described below

commit a03b8ca39a47f53bb6d24767dc4cf7c175e65bd2
Author: Jesse Rivas <je...@comcast.com>
AuthorDate: Fri Apr 20 10:28:02 2018 -0600

    added json response field use_reval_pending to update_status endpoint
---
 lib/go-tc/servers.go                                           | 1 +
 traffic_ops/traffic_ops_golang/server/servers_update_status.go | 8 ++++----
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/lib/go-tc/servers.go b/lib/go-tc/servers.go
index 7c58206..7d2e5d5 100644
--- a/lib/go-tc/servers.go
+++ b/lib/go-tc/servers.go
@@ -132,6 +132,7 @@ type ServerUpdateStatus struct {
 	HostName           string `json:"host_name"`
 	UpdatePending      bool   `json:"upd_pending"`
 	RevalPending       bool   `json:"reval_pending"`
+	UseRevalPending    bool   `json:"use_reval_pending"`
 	HostId             int    `json:"host_id"`
 	Status             string `json:"status"`
 	ParentPending      bool   `json:"parent_pending"`
diff --git a/traffic_ops/traffic_ops_golang/server/servers_update_status.go b/traffic_ops/traffic_ops_golang/server/servers_update_status.go
index 80e00ff..da2e49d 100644
--- a/traffic_ops/traffic_ops_golang/server/servers_update_status.go
+++ b/traffic_ops/traffic_ops_golang/server/servers_update_status.go
@@ -64,14 +64,14 @@ func getServerUpdateStatus(hostName string, db *sqlx.DB) ([]tc.ServerUpdateStatu
 		`WITH parentservers AS (SELECT ps.id, ps.cachegroup, ps.cdn_id, ps.upd_pending, ps.reval_pending FROM server ps
          LEFT JOIN status AS pstatus ON pstatus.id = ps.status
          WHERE pstatus.name != 'OFFLINE' ),
-         use_reval AS (SELECT value::boolean FROM parameter WHERE name = 'use_reval_pending' AND config_file = 'global' UNION ALL SELECT FALSE FETCH FIRST 1 ROW ONLY)
-         SELECT s.id, s.host_name, type.name AS type, (s.reval_pending::boolean AND use_reval.value) as combined_reval_pending, s.upd_pending, status.name AS status, COALESCE(bool_or(ps.upd_pending), FALSE) AS parent_upd_pending, COALESCE(bool_or(ps.reval_pending), FALSE) AS parent_reval_pending FROM use_reval, server s
+         use_reval_pending AS (SELECT value::boolean FROM parameter WHERE name = 'use_reval_pending' AND config_file = 'global' UNION ALL SELECT FALSE FETCH FIRST 1 ROW ONLY)
+         SELECT s.id, s.host_name, type.name AS type, (s.reval_pending::boolean) as server_reval_pending, use_reval_pending.value, s.upd_pending, status.name AS status, COALESCE(bool_or(ps.upd_pending), FALSE) AS parent_upd_pending, COALESCE(bool_or(ps.reval_pending), FALSE) AS parent_reval_pending FROM use_reval_pending, server s
          LEFT JOIN status ON s.status = status.id
          LEFT JOIN cachegroup cg ON s.cachegroup = cg.id
          LEFT JOIN type ON type.id = s.type
          LEFT JOIN parentservers ps ON ps.cachegroup = cg.parent_cachegroup_id AND ps.cdn_id = s.cdn_id AND type.name = 'EDGE'` //remove the EDGE reference if other server types should have their parents processed
 
-	groupBy := ` GROUP BY s.id, s.host_name, type.name, combined_reval_pending, s.upd_pending, status.name ORDER BY s.id;`
+	groupBy := ` GROUP BY s.id, s.host_name, type.name, server_reval_pending, use_reval_pending.value, s.upd_pending, status.name ORDER BY s.id;`
 
 	updateStatuses := []tc.ServerUpdateStatus{}
 	var rows *sql.Rows
@@ -94,7 +94,7 @@ func getServerUpdateStatus(hostName string, db *sqlx.DB) ([]tc.ServerUpdateStatu
 	for rows.Next() {
 		var serverUpdateStatus tc.ServerUpdateStatus
 		var serverType string
-		if err := rows.Scan(&serverUpdateStatus.HostId, &serverUpdateStatus.HostName, &serverType, &serverUpdateStatus.RevalPending, &serverUpdateStatus.UpdatePending, &serverUpdateStatus.Status, &serverUpdateStatus.ParentPending, &serverUpdateStatus.ParentRevalPending); err != nil {
+		if err := rows.Scan(&serverUpdateStatus.HostId, &serverUpdateStatus.HostName, &serverType, &serverUpdateStatus.RevalPending, &serverUpdateStatus.UseRevalPending, &serverUpdateStatus.UpdatePending, &serverUpdateStatus.Status, &serverUpdateStatus.ParentPending, &serverUpdateStatus.ParentRevalPending); err != nil {
 			log.Error.Printf("could not scan server update status: %s\n", err)
 			return nil, tc.DBError
 		}

-- 
To stop receiving notification emails like this one, please contact
dgelinas@apache.org.