[[:space:]] -> " "
This commit is contained in:
parent
2422e0b481
commit
a32b95544b
@ -215,7 +215,7 @@ _countdots() {
|
|||||||
# $3 - regex to recognise useful return lines
|
# $3 - regex to recognise useful return lines
|
||||||
_api_response_split() {
|
_api_response_split() {
|
||||||
printf '%s' "$1" \
|
printf '%s' "$1" \
|
||||||
| sed -r 's/(^[[:space:]]+|[[:space:]]+$)//g' \
|
| sed -r 's/(^ +| +$)//g' \
|
||||||
| tr -d '\n\r' \
|
| tr -d '\n\r' \
|
||||||
| sed -r "s/<\/?$2>/${NEWLINE}/g" \
|
| sed -r "s/<\/?$2>/${NEWLINE}/g" \
|
||||||
| egrep "$3"
|
| egrep "$3"
|
||||||
@ -241,15 +241,15 @@ _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.
|
||||||
|
|
||||||
statuslines="$(echo "$pleskxml_prettyprint_result" | egrep '^[[:space:]]*<status>[^<]*</status>[[:space:]]*$')"
|
statuslines="$(echo "$pleskxml_prettyprint_result" | egrep '^ *<status>[^<]*</status> *$')"
|
||||||
|
|
||||||
if _value "$statuslines" | grep -qv '<status>ok</status>'; then
|
if _value "$statuslines" | grep -qv '<status>ok</status>'; then
|
||||||
|
|
||||||
# We have some status lines that aren't "ok". Get the details
|
# We have some status lines that aren't "ok". Get the details
|
||||||
errtext="$(_value "$pleskxml_prettyprint_result" \
|
errtext="$(_value "$pleskxml_prettyprint_result" \
|
||||||
| egrep "(<status>|<errcode>|<errtext>)" \
|
| egrep "(<status>|<errcode>|<errtext>)" \
|
||||||
| sed -r 's/^<(status|errcode|errtext)>/\1: /' \
|
| sed -r 's/^ *<(status|errcode|errtext)>/\1: /' \
|
||||||
| sed -r 's/(^[[:space:]]+|<\/(status|errcode|errtext)>$)//g'
|
| sed -r 's/<\/(status|errcode|errtext)>$//g'
|
||||||
)"
|
)"
|
||||||
|
|
||||||
elif ! _value "$statuslines" | grep -q '<status>ok</status>'; then
|
elif ! _value "$statuslines" | grep -q '<status>ok</status>'; then
|
||||||
|
Loading…
Reference in New Issue
Block a user