Browse Source

shfmt

pull/2942/head
Gassan Gousseinov 4 years ago
parent
commit
b82c48b66f
  1. 12
      dnsapi/dns_hetzner.sh

12
dnsapi/dns_hetzner.sh

@ -56,8 +56,8 @@ dns_hetzner_add() {
else
_info "Found record id: $_record_id."
_info "Record found, do nothing."
return 0;
# # we could modify a record, if the names for txt records for *.example.com and example.com would be not the same
return 0
# we could modify a record, if the names for txt records for *.example.com and example.com would be not the same
#if _hetzner_rest PUT "records/${_record_id}" "{\"zone_id\":\"${HETZNER_Zone_ID}\",\"type\":\"TXT\",\"name\":\"$full_domain\",\"value\":\"$txt_value\",\"ttl\":120}"; then
# if _contains "$response" "$txt_value"; then
# _info "Modified, OK"
@ -107,12 +107,12 @@ dns_hetzner_rm() {
#returns
# _record_id=a8d58f22d6931bf830eaa0ec6464bf81 if found; or 1 if error
_find_record() {
unset _record_id;
unset _record_id
_record_name=$1
_record_value=$2
if [ -z "$_record_value" ]; then
_record_value="[^\"]*"
_record_value='[^"]*'
fi
_debug "Getting all records"
@ -129,7 +129,7 @@ _find_record() {
| while read -r record; do
# test for type and
if [ -n "$(echo "$record" | _egrep_o '"type":"TXT"')" ]; then
echo "$record" | _egrep_o "\"id\":\"[^\"]*\"" | cut -d : -f 2 | tr -d \"
echo "$record" | _egrep_o '"id":"[^"]*"' | cut -d : -f 2 | tr -d \"
break
fi
done
@ -160,7 +160,7 @@ _get_root() {
unset HETZNER_Zone_ID
else
if _contains "$response" "\"id\":\"$HETZNER_Zone_ID\""; then
_domain=$(printf "%s\n" "$response" | _egrep_o "\"name\":\"[^\"]*\"" | cut -d : -f 2 | tr -d \" | head -n 1)
_domain=$(printf "%s\n" "$response" | _egrep_o '"name":"[^"]*"' | cut -d : -f 2 | tr -d \" | head -n 1)
if [ "$_domain" ]; then
_cut_length=$((${#domain} - ${#_domain} - 1))
_sub_domain=$(printf "%s" "$domain" | cut -c "1-$_cut_length")

Loading…
Cancel
Save