Improved error handling
Improved error handling when result contains data-structure which might contain another status-flag that is related to the status of the related object and not the api call Revert "Improved error handling" This reverts commit fa6df1cfab134d38baad19fc1caa0842f00416d5. Revert "Revert "Improved error handling"" This reverts commit 5a4b78392f063863ee9f56686f5c429e9376af1b.
This commit is contained in:
parent
40e0d72105
commit
ba3e088b23
@ -251,9 +251,12 @@ _call_api() {
|
|||||||
|
|
||||||
# Detect any <status> that isn't "ok". None of the used calls should fail if the API is working correctly.
|
# Detect any <status> that isn't "ok". None of the used calls should fail if the API is working correctly.
|
||||||
# Also detect if there simply aren't any status lines (null result?) and report that, as well.
|
# Also detect if there simply aren't any status lines (null result?) and report that, as well.
|
||||||
|
# Remove <data></data> structure from result string, since it might contain <status> values that are related to the status of the domain and not to the API request
|
||||||
|
|
||||||
statuslines_count_total="$(echo "$pleskxml_prettyprint_result" | grep -c '^ *<status>[^<]*</status> *$')"
|
statuslines_count_total="$(echo "$pleskxml_prettyprint_result" | sed '/<data>/,/<\/data>/d' | grep -c '^ *<status>[^<]*</status> *$')"
|
||||||
statuslines_count_okay="$(echo "$pleskxml_prettyprint_result" | grep -c '^ *<status>ok</status> *$')"
|
statuslines_count_okay="$(echo "$pleskxml_prettyprint_result" | sed '/<data>/,/<\/data>/d' | grep -c '^ *<status>ok</status> *$')"
|
||||||
|
_debug "statuslines_count_total=$statuslines_count_total."
|
||||||
|
_debug "statuslines_count_okay=$statuslines_count_okay."
|
||||||
|
|
||||||
if [ -z "$statuslines_count_total" ]; then
|
if [ -z "$statuslines_count_total" ]; then
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user