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

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


The following commit(s) were added to refs/heads/master by this push:
     new e289a17  Fix some CIAB issues and add TC_LOC type to seeds.sql (#4626)
e289a17 is described below

commit e289a171434cfc50620f64193ff32a5789cfc022
Author: Rawlin Peters <[email protected]>
AuthorDate: Thu Apr 9 08:34:03 2020 -0600

    Fix some CIAB issues and add TC_LOC type to seeds.sql (#4626)
    
    Recently, creating types other than for use in the servers table was
    prohibited, so add a TC_LOC type to seeds.sql to be used for cachegroups
    containing servers that don't match the existing set of cachegroup
    types.
    
    Remove the TC_LOC and TR_LOC types from being created by the CIAB
    enroller and fix a few other bugs.
---
 infrastructure/cdn-in-a-box/edge/run.sh                            | 2 +-
 infrastructure/cdn-in-a-box/traffic_ops/run-go.sh                  | 2 +-
 infrastructure/cdn-in-a-box/traffic_ops/to-access.sh               | 4 ++--
 infrastructure/cdn-in-a-box/traffic_ops_data/types/030-TC_LOC.json | 5 -----
 infrastructure/cdn-in-a-box/traffic_ops_data/types/040-TR_LOC.json | 5 -----
 traffic_ops/app/db/seeds.sql                                       | 1 +
 6 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/infrastructure/cdn-in-a-box/edge/run.sh 
b/infrastructure/cdn-in-a-box/edge/run.sh
index 3c46038..72ec22e 100755
--- a/infrastructure/cdn-in-a-box/edge/run.sh
+++ b/infrastructure/cdn-in-a-box/edge/run.sh
@@ -69,7 +69,7 @@ while [[ -z "$(testenrolled)" ]]; do
 done
 
 # Wait for SSL keys to exist
-until to-get "api/2.0/cdns/name/$CDN_NAME/sslkeys" && [[ "$(to-get 
api/2.0/cdns/name/$CDN_NAME/sslkeys)" != '{"response":[]}' ]]; do
+until [[ $(to-get api/2.0/cdns/name/$CDN_NAME/sslkeys | jq '.response | 
length') -gt 0 ]]; do
        echo 'waiting for SSL keys to exist'
        sleep 3
 done
diff --git a/infrastructure/cdn-in-a-box/traffic_ops/run-go.sh 
b/infrastructure/cdn-in-a-box/traffic_ops/run-go.sh
index f23245f..c4f77ad 100755
--- a/infrastructure/cdn-in-a-box/traffic_ops/run-go.sh
+++ b/infrastructure/cdn-in-a-box/traffic_ops/run-go.sh
@@ -74,7 +74,7 @@ to-enroll "to" ALL || (while true; do echo "enroll failed."; 
sleep 3 ; done)
 while true; do
   echo "Verifying that edge was associated to delivery service..."
 
-  edge_name="$(to-get 'api/2.0/servers?hostName=edge' 2>/dev/null | jq -r -c 
'.response|.hostName')"
+  edge_name="$(to-get 'api/2.0/servers?hostName=edge' 2>/dev/null | jq -r -c 
'.response[0]|.hostName')"
   ds_name=$(to-get 'api/2.0/deliveryservices' 2>/dev/null | jq -r -c 
'.response[] | select(.cdnName == "'"$CDN_NAME"'").xmlId')
   ds_id=$(to-get 'api/2.0/deliveryservices' 2>/dev/null | jq -r -c 
'.response[] | select(.cdnName == "'"$CDN_NAME"'").id')
   edge_verify=$(to-get "/api/2.0/deliveryservices/$ds_id/servers" | jq -r 
'.response[]|.hostName')
diff --git a/infrastructure/cdn-in-a-box/traffic_ops/to-access.sh 
b/infrastructure/cdn-in-a-box/traffic_ops/to-access.sh
index bb8e6ca..35f3278 100755
--- a/infrastructure/cdn-in-a-box/traffic_ops/to-access.sh
+++ b/infrastructure/cdn-in-a-box/traffic_ops/to-access.sh
@@ -267,7 +267,7 @@ to-enroll() {
 
 # Tests that this server exists in Traffic Ops
 function testenrolled() {
-       local tmp="$(to-get     
'api/'$TO_API_VERSION'/servers?name='$MY_HOSTNAME'')"
+       local tmp="$(to-get     
'api/'$TO_API_VERSION'/servers?hostName='$MY_HOSTNAME'')"
        tmp=$(echo $tmp | jq 
'.response[]|select(.hostName=="'"$MY_HOSTNAME"'")')
        echo "$tmp"
 }
@@ -307,7 +307,7 @@ to-add-sslkeys() {
                json_response=$(to-post 
'api/'$TO_API_VERSION'/deliveryservices/sslkeys/add' "$json_request")
                if [[ -n "$json_response" ]] ; then
                        sleep 3
-                       cdn_sslkeys_response=$(to-get 
"api/$TO_API_VERSION/cdns/name/$1/sslkeys" | jq '.response[] | length')
+                       cdn_sslkeys_response=$(to-get 
"api/$TO_API_VERSION/cdns/name/$1/sslkeys" | jq '.response | length')
                        if ((cdn_sslkeys_response>0)); then
                                break
                        else
diff --git a/infrastructure/cdn-in-a-box/traffic_ops_data/types/030-TC_LOC.json 
b/infrastructure/cdn-in-a-box/traffic_ops_data/types/030-TC_LOC.json
deleted file mode 100644
index ae54bb1..0000000
--- a/infrastructure/cdn-in-a-box/traffic_ops_data/types/030-TC_LOC.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
-  "description": "Location for Traffic Control Component Servers",
-  "name": "TC_LOC",
-  "useInTable": "cachegroup"
-}
diff --git a/infrastructure/cdn-in-a-box/traffic_ops_data/types/040-TR_LOC.json 
b/infrastructure/cdn-in-a-box/traffic_ops_data/types/040-TR_LOC.json
deleted file mode 100644
index 5318c65..0000000
--- a/infrastructure/cdn-in-a-box/traffic_ops_data/types/040-TR_LOC.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
-  "description": "Traffic Router Logical Site",
-  "name": "TR_LOC",
-  "useInTable": "cachegroup"
-}
diff --git a/traffic_ops/app/db/seeds.sql b/traffic_ops/app/db/seeds.sql
index 38a2b59..fb940f4 100644
--- a/traffic_ops/app/db/seeds.sql
+++ b/traffic_ops/app/db/seeds.sql
@@ -768,6 +768,7 @@ insert into type (name, description, use_in_table) values 
('EDGE_LOC', 'Edge Log
 insert into type (name, description, use_in_table) values ('MID_LOC', 'Mid 
Logical Location', 'cachegroup') ON CONFLICT (name) DO NOTHING;
 insert into type (name, description, use_in_table) values ('ORG_LOC', 'Origin 
Logical Site', 'cachegroup') ON CONFLICT (name) DO NOTHING;
 insert into type (name, description, use_in_table) values ('TR_LOC', 'Traffic 
Router Logical Location', 'cachegroup') ON CONFLICT (name) DO NOTHING;
+insert into type (name, description, use_in_table) values ('TC_LOC', 'Traffic 
Control Component Location', 'cachegroup') ON CONFLICT (name) DO NOTHING;
 
 -- to_extension types
 insert into type (name, description, use_in_table) values 
('CHECK_EXTENSION_BOOL', 'Extension for checkmark in Server Check', 
'to_extension') ON CONFLICT (name) DO NOTHING;

Reply via email to