This is an automated email from the ASF dual-hosted git repository. rob pushed a commit to branch 2.2.x in repository https://gitbox.apache.org/repos/asf/incubator-trafficcontrol.git
commit 16f735869b7fd26881749849418134f1361a87ac Author: Jesse Rivas <jesse_ri...@comcast.com> AuthorDate: Fri Apr 20 10:28:02 2018 -0600 added json response field use_reval_pending to update_status endpoint (cherry picked from commit a03b8ca39a47f53bb6d24767dc4cf7c175e65bd2) --- lib/go-tc/servers.go | 1 + traffic_ops/traffic_ops_golang/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 24ffbc5..576269e 100644 --- a/lib/go-tc/servers.go +++ b/lib/go-tc/servers.go @@ -83,6 +83,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/servers_update_status.go b/traffic_ops/traffic_ops_golang/servers_update_status.go index b0282bd..369fbcc 100644 --- a/traffic_ops/traffic_ops_golang/servers_update_status.go +++ b/traffic_ops/traffic_ops_golang/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 r...@apache.org.