Travis refactoring

This commit is contained in:
Gerardo 2020-04-19 15:03:42 +02:00 committed by GitHub
parent 6e589de5eb
commit 3945a59ea4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -92,11 +92,9 @@ _initAuth() {
fi fi
domainData=$(echo "$response" | tr -d '\r') domainData=$(echo "$response" | tr -d '\r')
# get all Ids and peek only values # get all Ids and peek only values
temp="$(echo "$domainData" | _egrep_o "Id\": [^,]*" | cut -d : -f 2 | head -1)" temp="$(echo "$domainData" | _egrep_o "Id\": [^,]*" | cut -d : -f 2 | head -1)" # first element is zone Id
#read -ra ADDR <<< "$temp" #put Ids into array domain_id=$temp
domain_id=$temp # first element is zone Id
_info "DomainId is: $domain_id" _info "DomainId is: $domain_id"
_info "Consumer key is ok." _info "Consumer key is ok."
@ -172,21 +170,20 @@ dns_aruba_rm() {
_extract_record_id() { _extract_record_id() {
subdomain="$1" subdomain="$1"
_arrayid=0 _arrayid=0
_ids="$(echo $domainData | _egrep_o '"Id": [^,]+' | cut -d : -f 2)" _ids="$(echo "$domainData" | _egrep_o '"Id": [^,]+' | cut -d : -f 2)"
_debug $ids _debug $ids
#_temp="$(echo $domainData | grep -oP "\"DomainId\":\s\d{1,}," | tr -d ' ')" #_temp="$(echo $domainData | grep -oP "\"DomainId\":\s\d{1,}," | tr -d ' ')"
#_domainids="$(echo $_temp | tr -d ' ')" #_domainids="$(echo $_temp | tr -d ' ')"
_names="$(echo $domainData | _egrep_o '"Name": [^,]*' | cut -d : -f 2)" _names="$(echo "$domainData" | _egrep_o '"Name": [^,]*' | cut -d : -f 2)"
_debug $names _debug $names
ARRAY_IDS=$(echo $_ids | tr ", " "\n") ARRAY_IDS=$(echo "$_ids" | tr ", " "\n")
ARRAY_NAMES=$_names ARRAY_NAMES=$_names
j=0 j=0
for i in $ARRAY_NAMES; for i in $ARRAY_NAMES; do
do
if [ "$i" = "$subdomain" ]; then if [ "$i" = "$subdomain" ]; then
_debug printf "%s\t%s\n" "$i" _debug printf "%s\t%s\n" "$i"
_arrayname=$i #_arrayname=$i
_arrayId=$j _arrayId=$j
_info "Found txt record id: $_arrayId" _info "Found txt record id: $_arrayId"
fi fi
@ -194,8 +191,7 @@ _extract_record_id() {
done done
n=0 n=0
for i in $ARRAY_IDS; for i in $ARRAY_IDS; do
do
if [ "$n" = "$_arrayId" ]; then if [ "$n" = "$_arrayId" ]; then
_recordId=$i _recordId=$i
_info "recordid found: $_recordId" _info "recordid found: $_recordId"