From e61615ef51912f8e4e7447784787b09d485eb7ad Mon Sep 17 00:00:00 2001 From: pentadam Date: Mon, 27 Oct 2025 16:44:30 -0500 Subject: [PATCH] dns_ultra.sh: Improve zone detection reliability - Add direct zone access before falling back to zones list - This makes zone detection more reliable and faster by attempting to access the zone directly first, which is more efficient than listing all zones and searching through them --- dnsapi/dns_ultra.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/dnsapi/dns_ultra.sh b/dnsapi/dns_ultra.sh index e8da431c..c3a4fbe3 100644 --- a/dnsapi/dns_ultra.sh +++ b/dnsapi/dns_ultra.sh @@ -122,6 +122,18 @@ _get_root() { #not valid return 1 fi + # First try to access the zone directly (more reliable) + if _ultra_rest GET "zones/${h}"; then + if _contains "${response}" "\"name\":" >/dev/null; then + _domain_id="${h}" + _sub_domain=$(printf "%s" "$domain" | cut -d . -f 1-"$p") + _domain="${h}" + _debug sub_domain "${_sub_domain}" + _debug domain "${_domain}" + return 0 + fi + fi + # Fallback: check the zones list if direct access failed if ! _ultra_rest GET "zones"; then return 1 fi @@ -168,4 +180,4 @@ _ultra_login() { export _H2="" AUTH_TOKEN=$(_post "grant_type=password&username=${ULTRA_USR}&password=${ULTRA_PWD}" "${ULTRA_AUTH_API}authorization/token" | cut -d, -f3 | cut -d\" -f4) export AUTH_TOKEN -} +} \ No newline at end of file