fix zone search
This commit is contained in:
parent
ff357dd3fb
commit
dc2979926f
@ -108,7 +108,7 @@ _ionos_init() {
|
|||||||
_saveaccountconf_mutable IONOS_TOKEN "$IONOS_TOKEN"
|
_saveaccountconf_mutable IONOS_TOKEN "$IONOS_TOKEN"
|
||||||
|
|
||||||
if ! _get_cloud_zone "$fulldomain"; then
|
if ! _get_cloud_zone "$fulldomain"; then
|
||||||
_err "Cannot find this zone in your IONOS account."
|
_err "Cannot find zone $zone in your IONOS account."
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
$_context="cloud"
|
$_context="cloud"
|
||||||
@ -165,20 +165,17 @@ _get_root() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_get_cloud_zone() {
|
_get_cloud_zone() {
|
||||||
zone=$1
|
domain=$1
|
||||||
i=1
|
zone=$(printf "%s" "$domain" | cut -d . -f 2-)
|
||||||
p=1
|
|
||||||
|
|
||||||
if _ionos_cloud_rest GET "$IONOS_CLOUD_ROUTE_ZONES?filter.zoneName=$zone"; then
|
if _ionos_cloud_rest GET "$IONOS_CLOUD_ROUTE_ZONES?filter.zoneName=$zone"; then
|
||||||
_response="$(echo "$_response" | tr -d "\n")"
|
_response="$(echo "$_response" | tr -d "\n")"
|
||||||
|
|
||||||
_zone="$(echo "$_response" | _egrep_o "\"name\":\"$zone\".*\}")"
|
_zone_list_items=$(echo "$_response" | _egrep_o "\"items\":.*")
|
||||||
if [ "$_zone" ]; then
|
|
||||||
_zone_id=$(printf "%s\n" "$_zone" | _egrep_o "\"id\":\"[a-fA-F0-9\-]*\"" | _head_n 1 | cut -d : -f 2 | tr -d '\"')
|
_zone_id=$(printf "%s\n" "$_zone_list_items" | _egrep_o "\"id\":\"[a-fA-F0-9\-]*\"" | _head_n 1 | cut -d : -f 2 | tr -d '\"')
|
||||||
if [ "$_zone_id" ]; then
|
if [ "$_zone_id" ]; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
|
||||||
return 1
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user