mirror of
https://github.com/acmesh-official/acme.sh.git
synced 2026-08-13 12:33:30 +02:00
dns_infomaniak: log zones response and fail early in _get_zone
The sed in _get_zone passed the raw JSON through when the response
contained no [{"fqdn":", so an API error turned the zone into "{" and
the failure only surfaced later as POST /2/zones/{/records
"method_not_found". Log the response at debug2, error out on
non-success results, and parse fqdn position-independently.
https://github.com/acmesh-official/acme.sh/issues/6851
This commit is contained in:
parent
17964cfd6e
commit
020123d812
1 changed files with 7 additions and 3 deletions
|
|
@ -182,7 +182,11 @@ dns_infomaniak_rm() {
|
|||
_get_zone() {
|
||||
domain="$1"
|
||||
# Whatever the domain is, you can get the fqdn with the following.
|
||||
# shellcheck disable=SC1004
|
||||
response=$(_get "${INFOMANIAK_API_URL}/2/domains/${domain}/zones" | sed 's/.*\[{"fqdn"\:"\(.*\)/\1/')
|
||||
echo "${response%%\"*}"
|
||||
response=$(_get "${INFOMANIAK_API_URL}/2/domains/${domain}/zones")
|
||||
_debug2 "_get_zone response" "$response"
|
||||
if ! _contains "$response" '"result":"success"'; then
|
||||
_err "cannot get zones for ${domain}, response: ${response}"
|
||||
return 1
|
||||
fi
|
||||
echo "$response" | _egrep_o '"fqdn" *: *"[^"]*"' | _head_n 1 | cut -d '"' -f 4
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue