Browse Source

Fix detecting response for record already added

pull/165/head
Tomasz Słodkowicz 9 years ago
parent
commit
845be28526
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      dns_scripts/dns_add_cloudflare

+ 1
- 1
dns_scripts/dns_add_cloudflare View File

@ -36,7 +36,7 @@ domain_id=${ids[i]}
resp=$(curl --silent "${PARAMS[@]}" -X POST "$API/$domain_id/dns_records" \
--data "{\"type\":\"TXT\",\"name\":\"_acme-challenge.${fulldomain%.$domain}\",\"content\":\"$token\",\"ttl\":300}")
# code 81057 = The record already exists.
if [[ "${resp// }" == *'"success":false'* && ! "${resp// }" == *'"code":81057[^0-9]'* ]]; then
if [[ "${resp// }" == *'"success":false'* && ! "${resp// }" == *'"code":81057'[^0-9]* ]]; then
re='"message":"([^"]+)"'; [[ "$resp" =~ $re ]]
echo "Error: DNS challenge not added: ${BASH_REMATCH[1]:-unknown error}"; exit 2
fi

Loading…
Cancel
Save