You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by mi...@apache.org on 2018/11/06 20:09:17 UTC

[trafficcontrol] branch master updated (612bedd -> 4368cb4)

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

mitchell852 pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git.


    from 612bedd  Prevent Perl input record separator change in TO dbdump API
     new aa07cea  escape bare names
     new 4368cb4  fix cdn-in-a-box json for client code changes

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../deliveryservices/010-ciab.json                 |  1 -
 .../traffic_ops_data/profiles/060-GLOBAL.json      | 48 ----------------------
 traffic_ops/client/cachegroup.go                   |  5 ++-
 traffic_ops/client/cdn.go                          |  3 +-
 traffic_ops/client/deliveryservice_requests.go     |  3 +-
 traffic_ops/client/origin.go                       |  3 +-
 traffic_ops/client/phys_location.go                |  3 +-
 traffic_ops/client/region.go                       |  5 ++-
 traffic_ops/client/role.go                         |  3 +-
 traffic_ops/client/traffic_monitor.go              |  1 +
 10 files changed, 17 insertions(+), 58 deletions(-)
 delete mode 100644 infrastructure/cdn-in-a-box/traffic_ops_data/profiles/060-GLOBAL.json


[trafficcontrol] 01/02: escape bare names

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit aa07cea3cbf475d3124131350ea172ca3d95fe96
Author: Dan Kirkwood <da...@apache.org>
AuthorDate: Mon Nov 5 16:35:20 2018 -0700

    escape bare names
---
 traffic_ops/client/cachegroup.go               | 5 +++--
 traffic_ops/client/cdn.go                      | 3 ++-
 traffic_ops/client/deliveryservice_requests.go | 3 ++-
 traffic_ops/client/origin.go                   | 3 ++-
 traffic_ops/client/phys_location.go            | 3 ++-
 traffic_ops/client/region.go                   | 5 +++--
 traffic_ops/client/role.go                     | 3 ++-
 traffic_ops/client/traffic_monitor.go          | 1 +
 8 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/traffic_ops/client/cachegroup.go b/traffic_ops/client/cachegroup.go
index e0dd5ad..ad43ced 100644
--- a/traffic_ops/client/cachegroup.go
+++ b/traffic_ops/client/cachegroup.go
@@ -21,6 +21,7 @@ import (
 	"fmt"
 	"net"
 	"net/http"
+	"net/url"
 
 	"github.com/apache/trafficcontrol/lib/go-tc"
 )
@@ -253,7 +254,7 @@ func (to *Session) GetCacheGroupByID(id int) ([]tc.CacheGroup, ReqInf, error) {
 
 // GET a CacheGroup by the CacheGroup name
 func (to *Session) GetCacheGroupNullableByName(name string) ([]tc.CacheGroupNullable, ReqInf, error) {
-	url := fmt.Sprintf("%s?name=%s", API_v13_CacheGroups, name)
+	url := fmt.Sprintf("%s?name=%s", API_v13_CacheGroups, url.QueryEscape(name))
 	resp, remoteAddr, err := to.request(http.MethodGet, url, nil)
 	reqInf := ReqInf{CacheHitStatus: CacheHitStatusMiss, RemoteAddr: remoteAddr}
 	if err != nil {
@@ -272,7 +273,7 @@ func (to *Session) GetCacheGroupNullableByName(name string) ([]tc.CacheGroupNull
 // GET a CacheGroup by the CacheGroup name
 // Deprecated: use GetCachegroupNullableByName
 func (to *Session) GetCacheGroupByName(name string) ([]tc.CacheGroup, ReqInf, error) {
-	url := fmt.Sprintf("%s?name=%s", API_v13_CacheGroups, name)
+	url := fmt.Sprintf("%s?name=%s", API_v13_CacheGroups, url.QueryEscape(name))
 	resp, remoteAddr, err := to.request(http.MethodGet, url, nil)
 	reqInf := ReqInf{CacheHitStatus: CacheHitStatusMiss, RemoteAddr: remoteAddr}
 	if err != nil {
diff --git a/traffic_ops/client/cdn.go b/traffic_ops/client/cdn.go
index 008f384..4503a78 100644
--- a/traffic_ops/client/cdn.go
+++ b/traffic_ops/client/cdn.go
@@ -20,6 +20,7 @@ import (
 	"fmt"
 	"net"
 	"net/http"
+	"net/url"
 
 	"github.com/apache/trafficcontrol/lib/go-tc"
 )
@@ -101,7 +102,7 @@ func (to *Session) GetCDNByID(id int) ([]tc.CDN, ReqInf, error) {
 
 // GET a CDN by the CDN name
 func (to *Session) GetCDNByName(name string) ([]tc.CDN, ReqInf, error) {
-	url := fmt.Sprintf("%s?name=%s", API_v13_CDNs, name)
+	url := fmt.Sprintf("%s?name=%s", API_v13_CDNs, url.QueryEscape(name))
 	resp, remoteAddr, err := to.request(http.MethodGet, url, nil)
 	reqInf := ReqInf{CacheHitStatus: CacheHitStatusMiss, RemoteAddr: remoteAddr}
 	if err != nil {
diff --git a/traffic_ops/client/deliveryservice_requests.go b/traffic_ops/client/deliveryservice_requests.go
index e01182d..249506c 100644
--- a/traffic_ops/client/deliveryservice_requests.go
+++ b/traffic_ops/client/deliveryservice_requests.go
@@ -22,6 +22,7 @@ import (
 	"io/ioutil"
 	"net"
 	"net/http"
+	"net/url"
 
 	"github.com/apache/trafficcontrol/lib/go-tc"
 )
@@ -131,7 +132,7 @@ func (to *Session) GetDeliveryServiceRequests() ([]tc.DeliveryServiceRequest, Re
 
 // GET a DeliveryServiceRequest by the DeliveryServiceRequest XMLID
 func (to *Session) GetDeliveryServiceRequestByXMLID(XMLID string) ([]tc.DeliveryServiceRequest, ReqInf, error) {
-	route := fmt.Sprintf("%s?xmlId=%s", API_DS_REQUESTS, XMLID)
+	route := fmt.Sprintf("%s?xmlId=%s", API_DS_REQUESTS, url.QueryEscape(XMLID))
 	resp, remoteAddr, err := to.request(http.MethodGet, route, nil)
 
 	reqInf := ReqInf{CacheHitStatus: CacheHitStatusMiss, RemoteAddr: remoteAddr}
diff --git a/traffic_ops/client/origin.go b/traffic_ops/client/origin.go
index 9e89d66..222b249 100644
--- a/traffic_ops/client/origin.go
+++ b/traffic_ops/client/origin.go
@@ -21,6 +21,7 @@ import (
 	"fmt"
 	"net"
 	"net/http"
+	"net/url"
 
 	"github.com/apache/trafficcontrol/lib/go-tc"
 )
@@ -168,7 +169,7 @@ func (to *Session) GetOriginByID(id int) ([]tc.Origin, ReqInf, error) {
 
 // GET an Origin by the Origin name
 func (to *Session) GetOriginByName(name string) ([]tc.Origin, ReqInf, error) {
-	return to.GetOriginsByQueryParams(fmt.Sprintf("?name=%s", name))
+	return to.GetOriginsByQueryParams(fmt.Sprintf("?name=%s", url.QueryEscape(name)))
 }
 
 // GET a list of Origins by Delivery Service ID
diff --git a/traffic_ops/client/phys_location.go b/traffic_ops/client/phys_location.go
index baa326f..3ce2261 100644
--- a/traffic_ops/client/phys_location.go
+++ b/traffic_ops/client/phys_location.go
@@ -21,6 +21,7 @@ import (
 	"fmt"
 	"net"
 	"net/http"
+	"net/url"
 
 	"github.com/apache/trafficcontrol/lib/go-tc"
 )
@@ -111,7 +112,7 @@ func (to *Session) GetPhysLocationByID(id int) ([]tc.PhysLocation, ReqInf, error
 
 // GET a PhysLocation by the PhysLocation name
 func (to *Session) GetPhysLocationByName(name string) ([]tc.PhysLocation, ReqInf, error) {
-	url := fmt.Sprintf("%s?name=%s", API_v13_PhysLocations, name)
+	url := fmt.Sprintf("%s?name=%s", API_v13_PhysLocations, url.QueryEscape(name))
 	resp, remoteAddr, err := to.request(http.MethodGet, url, nil)
 	reqInf := ReqInf{CacheHitStatus: CacheHitStatusMiss, RemoteAddr: remoteAddr}
 	if err != nil {
diff --git a/traffic_ops/client/region.go b/traffic_ops/client/region.go
index 5eb4df8..5d9146e 100644
--- a/traffic_ops/client/region.go
+++ b/traffic_ops/client/region.go
@@ -21,6 +21,7 @@ import (
 	"fmt"
 	"net"
 	"net/http"
+	"net/url"
 
 	"github.com/apache/trafficcontrol/lib/go-tc"
 )
@@ -112,7 +113,7 @@ func (to *Session) GetRegionByID(id int) ([]tc.Region, ReqInf, error) {
 
 // GET a Region by the Region name
 func (to *Session) GetRegionByName(name string) ([]tc.Region, ReqInf, error) {
-	url := fmt.Sprintf("%s?name=%s", API_v13_REGIONS, name)
+	url := fmt.Sprintf("%s?name=%s", API_v13_REGIONS, url.QueryEscape(name))
 	resp, remoteAddr, err := to.request(http.MethodGet, url, nil)
 	reqInf := ReqInf{CacheHitStatus: CacheHitStatusMiss, RemoteAddr: remoteAddr}
 	if err != nil {
@@ -144,7 +145,7 @@ func (to *Session) DeleteRegionByID(id int) (tc.Alerts, ReqInf, error) {
 
 // GetRegionByNamePath gets a region by name, using the /api/version/region/name path. This gets the same data as GetRegionByName, but uses a different API path to get the same data, and returns a slightly different format.
 func (to *Session) GetRegionByNamePath(name string) ([]tc.RegionName, ReqInf, error) {
-	url := apiBase + `/regions/name/` + name
+	url := apiBase + `/regions/name/` + url.QueryEscape(name)
 	reqResp, remoteAddr, err := to.request(http.MethodGet, url, nil)
 	reqInf := ReqInf{CacheHitStatus: CacheHitStatusMiss, RemoteAddr: remoteAddr}
 	if err != nil {
diff --git a/traffic_ops/client/role.go b/traffic_ops/client/role.go
index d403cfc..5e0c185 100644
--- a/traffic_ops/client/role.go
+++ b/traffic_ops/client/role.go
@@ -20,6 +20,7 @@ import (
 	"fmt"
 	"net"
 	"net/http"
+	"net/url"
 
 	"github.com/apache/trafficcontrol/lib/go-tc"
 )
@@ -106,7 +107,7 @@ func (to *Session) GetRoleByID(id int) ([]tc.Role, ReqInf, int, error) {
 
 // GET a Role by the Role name
 func (to *Session) GetRoleByName(name string) ([]tc.Role, ReqInf, int, error) {
-	url := fmt.Sprintf("%s?name=%s", API_v13_ROLES, name)
+	url := fmt.Sprintf("%s?name=%s", API_v13_ROLES, url.QueryEscape(name))
 	resp, remoteAddr, errClient := to.rawRequest(http.MethodGet, url, nil)
 	reqInf := ReqInf{CacheHitStatus: CacheHitStatusMiss, RemoteAddr: remoteAddr}
 	if resp != nil {
diff --git a/traffic_ops/client/traffic_monitor.go b/traffic_ops/client/traffic_monitor.go
index 73905a6..bd8528a 100644
--- a/traffic_ops/client/traffic_monitor.go
+++ b/traffic_ops/client/traffic_monitor.go
@@ -3,6 +3,7 @@ package client
 import (
 	"encoding/json"
 	"fmt"
+
 	"github.com/apache/trafficcontrol/lib/go-tc"
 )
 


[trafficcontrol] 02/02: fix cdn-in-a-box json for client code changes

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 4368cb4d5e8c21ae406700351bd48614f674fa31
Author: Dan Kirkwood <da...@apache.org>
AuthorDate: Tue Nov 6 10:59:32 2018 -0700

    fix cdn-in-a-box json for client code changes
---
 .../deliveryservices/010-ciab.json                 |  1 -
 .../traffic_ops_data/profiles/060-GLOBAL.json      | 48 ----------------------
 2 files changed, 49 deletions(-)

diff --git a/infrastructure/cdn-in-a-box/traffic_ops_data/deliveryservices/010-ciab.json b/infrastructure/cdn-in-a-box/traffic_ops_data/deliveryservices/010-ciab.json
index 32d95d0..8cf57eb 100644
--- a/infrastructure/cdn-in-a-box/traffic_ops_data/deliveryservices/010-ciab.json
+++ b/infrastructure/cdn-in-a-box/traffic_ops_data/deliveryservices/010-ciab.json
@@ -17,7 +17,6 @@
     "multiSiteOrigin": false,
     "missLat": 42.0,
     "missLong": -88.0,
-    "profileName": "",
     "qstringIgnore": 0,
     "rangeRequestHandling": 0,
     "regionalGeoBlocking": false,
diff --git a/infrastructure/cdn-in-a-box/traffic_ops_data/profiles/060-GLOBAL.json b/infrastructure/cdn-in-a-box/traffic_ops_data/profiles/060-GLOBAL.json
deleted file mode 100644
index cfc309f..0000000
--- a/infrastructure/cdn-in-a-box/traffic_ops_data/profiles/060-GLOBAL.json
+++ /dev/null
@@ -1,48 +0,0 @@
-{
-  "cdnName": "ALL",
-  "name": "GLOBAL",
-  "type": "UNK_PROFILE",
-  "description": "Global Traffic Ops profile, DO NOT DELETE",
-  "params": [
-    {
-      "configFile": "global",
-      "name": "tm.url",
-      "value": "https://trafficops.infra.ciab.test:443/"
-    },
-    {
-      "configFile": "global",
-      "name": "tm.logourl",
-      "value": "/images/tc_logo.png"
-    },
-    {
-      "configFile": "global",
-      "name": "tm.instance_name",
-      "value": "CDN-In-A-Box"
-    },
-    {
-      "configFile": "global",
-      "name": "tm.toolname",
-      "value": "Traffic Ops"
-    },
-    {
-      "configFile": "global",
-      "name": "use_reval_pending",
-      "value": "0"
-    },
-    {
-      "configFile": "global",
-      "name": "use_tenancy",
-      "value": "1"
-    },
-    {
-      "configFile": "global",
-      "name": "default_geo_miss_latitude",
-      "value": "0"
-    },
-    {
-      "configFile": "global",
-      "name": "default_geo_miss_longitude",
-      "value": "-1"
-    }
-  ]
-}