Browse Source

Travis refactoring

pull/3286/head
Gerardo 5 years ago
committed by GitHub
parent
commit
3945a59ea4
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 22
      dnsapi/dns_aruba.sh

22
dnsapi/dns_aruba.sh

@ -91,12 +91,10 @@ _initAuth() {
return 1 return 1
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)"
#read -ra ADDR <<< "$temp" #put Ids into array
domain_id=$temp # first element is zone Id
temp="$(echo "$domainData" | _egrep_o "Id\": [^,]*" | cut -d : -f 2 | head -1)" # first element is zone Id
domain_id=$temp
_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;
do
for i in $ARRAY_NAMES; 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;
do
for i in $ARRAY_IDS; do
if [ "$n" = "$_arrayId" ]; then if [ "$n" = "$_arrayId" ]; then
_recordId=$i _recordId=$i
_info "recordid found: $_recordId" _info "recordid found: $_recordId"

Loading…
Cancel
Save