Browse Source

fix for acme v2

neilpang 7 years ago
parent
commit
849a6c12be
1 changed files with 5 additions and 37 deletions
  1. 5 37
      dnsapi/dns_cx.sh

+ 5 - 37
dnsapi/dns_cx.sh

@@ -36,33 +36,18 @@ dns_cx_add() {
     return 1
     return 1
   fi
   fi
 
 
-  existing_records "$_domain" "$_sub_domain"
-  _debug count "$count"
-  if [ "$?" != "0" ]; then
-    _err "Error get existing records."
-    return 1
-  fi
-
-  if [ "$count" = "0" ]; then
-    add_record "$_domain" "$_sub_domain" "$txtvalue"
-  else
-    update_record "$_domain" "$_sub_domain" "$txtvalue"
-  fi
-
-  if [ "$?" = "0" ]; then
-    return 0
-  fi
-  return 1
+  add_record "$_domain" "$_sub_domain" "$txtvalue"
 }
 }
 
 
-#fulldomain
+#fulldomain txtvalue
 dns_cx_rm() {
 dns_cx_rm() {
   fulldomain=$1
   fulldomain=$1
+  txtvalue=$2
   REST_API="$CX_Api"
   REST_API="$CX_Api"
   if _get_root "$fulldomain"; then
   if _get_root "$fulldomain"; then
     record_id=""
     record_id=""
-    existing_records "$_domain" "$_sub_domain"
-    if ! [ "$record_id" = "" ]; then
+    existing_records "$_domain" "$_sub_domain" "$txtvalue"
+    if [ "$record_id" ]; then
       _rest DELETE "record/$record_id/$_domain_id" "{}"
       _rest DELETE "record/$record_id/$_domain_id" "{}"
       _info "Deleted record ${fulldomain}"
       _info "Deleted record ${fulldomain}"
     fi
     fi
@@ -114,23 +99,6 @@ add_record() {
   return 0
   return 0
 }
 }
 
 
-#update the txt record
-#Usage: root sub txtvalue
-update_record() {
-  root=$1
-  sub=$2
-  txtvalue=$3
-  fulldomain="$sub.$root"
-
-  _info "Updating record"
-
-  if _rest PUT "record/$record_id" "{\"domain_id\": $_domain_id, \"host\":\"$_sub_domain\", \"value\":\"$txtvalue\", \"type\":\"TXT\",\"ttl\":600, \"line_id\":1}"; then
-    return 0
-  fi
-
-  return 1
-}
-
 ####################  Private functions below ##################################
 ####################  Private functions below ##################################
 #_acme-challenge.www.domain.com
 #_acme-challenge.www.domain.com
 #returns
 #returns