1
0
Эх сурвалжийг харах

set newLastUsedRidForDomainEntry after request was successfull

AlvinSchiller 3 жил өмнө
parent
commit
7a1f94bc20
1 өөрчлөгдсөн 11 нэмэгдсэн , 10 устгасан
  1. 11 10
      dnsapi/dns_selfhost.sh

+ 11 - 10
dnsapi/dns_selfhost.sh

@@ -53,6 +53,17 @@ dns_selfhost_add() {
     rid="$rid2"
   fi
 
+  _info "Trying to add $txt on selfhost for rid: $rid"
+
+  data="?username=$SELFHOSTDNS_USERNAME&password=$SELFHOSTDNS_PASSWORD&rid=$rid&content=$txt"
+  response="$(_get "$SELFHOSTDNS_UPDATE_URL$data")"
+
+  if ! echo "$response" | grep "200 OK" >/dev/null; then
+    _err "Invalid response of acme-dns for selfhost"
+    return 1
+  fi
+
+  # write last used rid domain
   newLastUsedRidForDomainEntry="$fulldomain:$rid"
   if ! test -z "$lastUsedRidForDomainEntry"; then
     # replace last used rid entry for domain
@@ -66,16 +77,6 @@ dns_selfhost_add() {
     fi
   fi
 
-  _info "Trying to add $txt on selfhost for rid: $rid"
-
-  data="?username=$SELFHOSTDNS_USERNAME&password=$SELFHOSTDNS_PASSWORD&rid=$rid&content=$txt"
-  response="$(_get "$SELFHOSTDNS_UPDATE_URL$data")"
-
-  if ! echo "$response" | grep "200 OK" >/dev/null; then
-    _err "Invalid response of acme-dns for selfhost"
-    return 1
-  fi
-
   # Now that we know the values are good, save them
   _saveaccountconf_mutable SELFHOSTDNS_USERNAME "$SELFHOSTDNS_USERNAME"
   _saveaccountconf_mutable SELFHOSTDNS_PASSWORD "$SELFHOSTDNS_PASSWORD"