|
|
@ -59,10 +59,10 @@ dns_nsone_add() { |
|
|
|
_err "Add txt record error." |
|
|
|
else |
|
|
|
_info "Updating record" |
|
|
|
record_id=$(printf "%s\n" "$response" | _egrep_o "\"domain\":\"$fulldomain.\",[^{]*\"type\":\"TXT\",\"id\":\"[^,]*\"" | _head_n 1 | cut -d: -f7 | cut -d, -f1) |
|
|
|
_debug "record_id" "$record_id" |
|
|
|
prev_txt=$(printf "%s\n" "$response" | _egrep_o "\"domain\":\"$fulldomain\",\"short_answers\":\[\"[^,]*\]" | _head_n 1 | cut -d: -f3 | cut -d, -f1) |
|
|
|
_debug "prev_txt" "$prev_txt" |
|
|
|
|
|
|
|
_nsone_rest POST "zones/$_domain/$fulldomain/TXT" "{\"answers\": [{\"answer\": [\"$txtvalue\"]}],\"type\": \"TXT\",\"domain\":\"$fulldomain\",\"zone\": \"$_domain\"}" |
|
|
|
_nsone_rest POST "zones/$_domain/$fulldomain/TXT" "{\"answers\": [{\"answer\": [\"$txtvalue\"]},{\"answer\": $prev_txt}],\"type\": \"TXT\",\"domain\":\"$fulldomain\",\"zone\": \"$_domain\"}" |
|
|
|
if [ "$?" = "0" ] && _contains "$response" "$fulldomain"; then |
|
|
|
_info "Updated!" |
|
|
|
#todo: check if the record takes effect |
|
|
|