You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by de...@apache.org on 2018/05/04 14:15:18 UTC
[incubator-trafficcontrol] branch master updated: Fix TO Go
CRConfig to omit null missLocations
This is an automated email from the ASF dual-hosted git repository.
dewrich 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 98f72dd Fix TO Go CRConfig to omit null missLocations
98f72dd is described below
commit 98f72dddd882ffc841964ebad2058fce7055bfe4
Author: Robert Butts <ro...@apache.org>
AuthorDate: Thu May 3 12:49:15 2018 -0600
Fix TO Go CRConfig to omit null missLocations
---
traffic_ops/traffic_ops_golang/crconfig/deliveryservice.go | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/traffic_ops/traffic_ops_golang/crconfig/deliveryservice.go b/traffic_ops/traffic_ops_golang/crconfig/deliveryservice.go
index 078487f..802cbc5 100644
--- a/traffic_ops/traffic_ops_golang/crconfig/deliveryservice.go
+++ b/traffic_ops/traffic_ops_golang/crconfig/deliveryservice.go
@@ -105,7 +105,6 @@ and d.active = true
for rows.Next() {
ds := tc.CRConfigDeliveryService{
- MissLocation: &tc.CRConfigLatitudeLongitudeShort{},
Protocol: &tc.CRConfigDeliveryServiceProtocol{},
ResponseHeaders: map[string]string{},
Soa: cdnSOA,
@@ -139,12 +138,13 @@ and d.active = true
if err := rows.Scan(&xmlID, &missLat, &missLon, &protocol, &ds.TTL, &ds.RoutingName, &geoProvider, &ttype, &geoLimit, &geoLimitCountries, &geoLimitRedirectURL, &dispersion, &geoBlocking, &trRespHdrsStr, &maxDNSAnswers, &profile, &dnsBypassIP, &dnsBypassIP6, &dnsBypassTTL, &dnsBypassCName, &httpBypassFQDN, &ip6RoutingEnabled, &deepCachingType, &trRequestHeaders, &trResponseHeaders); err != nil {
return nil, errors.New("scanning deliveryservice: " + err.Error())
}
-
- if missLat.Valid {
- ds.MissLocation.Lat = missLat.Float64
- }
- if missLon.Valid {
- ds.MissLocation.Lon = missLon.Float64
+ // TODO prevent (lat XOR lon) in the DB and UI
+ if missLat.Valid && missLon.Valid {
+ ds.MissLocation = &tc.CRConfigLatitudeLongitudeShort{Lat: missLat.Float64, Lon: missLon.Float64}
+ } else if missLat.Valid {
+ log.Warnln("delivery service " + xmlID + " has miss latitude but not longitude: omitting miss lat-lon from CRConfig")
+ } else if missLon.Valid {
+ log.Warnln("delivery service " + xmlID + " has miss longitude but not latitude: omitting miss lat-lon from CRConfig")
}
if ttl.Valid {
ttl := int(ttl.Int64)
--
To stop receiving notification emails like this one, please contact
dewrich@apache.org.