Commit 19c43451 authored by neil's avatar neil
Browse files

fix shfmt

parent d5d38b33
...@@ -144,7 +144,7 @@ _netlify_rest() { ...@@ -144,7 +144,7 @@ _netlify_rest() {
export _H1="Content-Type: application/json" export _H1="Content-Type: application/json"
export _H2="Authorization: Bearer $token_trimmed" export _H2="Authorization: Bearer $token_trimmed"
:>"$HTTP_HEADER" : >"$HTTP_HEADER"
if [ "$m" != "GET" ]; then if [ "$m" != "GET" ]; then
_debug data "$data" _debug data "$data"
......
...@@ -136,11 +136,12 @@ dns_pleskxml_rm() { ...@@ -136,11 +136,12 @@ dns_pleskxml_rm() {
# Reduce output to one line per DNS record, filtered for TXT records with a record ID only (which they should all have) # Reduce output to one line per DNS record, filtered for TXT records with a record ID only (which they should all have)
# Also strip out spaces between tags, redundant <data> and </data> group tags and any <self-closing/> tags # Also strip out spaces between tags, redundant <data> and </data> group tags and any <self-closing/> tags
reclist="$(_api_response_split "$pleskxml_prettyprint_result" 'result' '<status>ok</status>' \ reclist="$(
| sed 's# \{1,\}<\([a-zA-Z]\)#<\1#g;s#</\{0,1\}data>##g;s#<[a-z][^/<>]*/>##g' \ _api_response_split "$pleskxml_prettyprint_result" 'result' '<status>ok</status>' |
| grep "<site-id>${root_domain_id}</site-id>" \ sed 's# \{1,\}<\([a-zA-Z]\)#<\1#g;s#</\{0,1\}data>##g;s#<[a-z][^/<>]*/>##g' |
| grep '<id>[0-9]\{1,\}</id>' \ grep "<site-id>${root_domain_id}</site-id>" |
| grep '<type>TXT</type>' grep '<id>[0-9]\{1,\}</id>' |
grep '<type>TXT</type>'
)" )"
if [ -z "$reclist" ]; then if [ -z "$reclist" ]; then
...@@ -151,10 +152,11 @@ dns_pleskxml_rm() { ...@@ -151,10 +152,11 @@ dns_pleskxml_rm() {
_debug "Got list of DNS TXT records for root domain '$root_domain_name':" _debug "Got list of DNS TXT records for root domain '$root_domain_name':"
_debug "$reclist" _debug "$reclist"
recid="$(_value "$reclist" \ recid="$(
| grep "<host>${fulldomain}.</host>" \ _value "$reclist" |
| grep "<value>${txtvalue}</value>" \ grep "<host>${fulldomain}.</host>" |
| sed 's/^.*<id>\([0-9]\{1,\}\)<\/id>.*$/\1/' grep "<value>${txtvalue}</value>" |
sed 's/^.*<id>\([0-9]\{1,\}\)<\/id>.*$/\1/'
)" )"
if ! _value "$recid" | grep '^[0-9]\{1,\}$' >/dev/null; then if ! _value "$recid" | grep '^[0-9]\{1,\}$' >/dev/null; then
...@@ -220,11 +222,11 @@ _countdots() { ...@@ -220,11 +222,11 @@ _countdots() {
# Last line could change to <sed -n '/.../p'> instead, with suitable escaping of ['"/$], # Last line could change to <sed -n '/.../p'> instead, with suitable escaping of ['"/$],
# if future Plesk XML API changes ever require extended regex # if future Plesk XML API changes ever require extended regex
_api_response_split() { _api_response_split() {
printf '%s' "$1" \ printf '%s' "$1" |
| sed 's/^ +//;s/ +$//' \ sed 's/^ +//;s/ +$//' |
| tr -d '\n\r' \ tr -d '\n\r' |
| sed "s/<\/\{0,1\}$2>/${NEWLINE}/g" \ sed "s/<\/\{0,1\}$2>/${NEWLINE}/g" |
| grep "$3" grep "$3"
} }
#################### Private functions below (DNS functions) ################################## #################### Private functions below (DNS functions) ##################################
...@@ -265,10 +267,11 @@ _call_api() { ...@@ -265,10 +267,11 @@ _call_api() {
# - filter output to keep only lines like this: "SPACES<TAG>text</TAG>SPACES" (shouldn't be necessary with prettyprint but guarantees subsequent code is ok) # - filter output to keep only lines like this: "SPACES<TAG>text</TAG>SPACES" (shouldn't be necessary with prettyprint but guarantees subsequent code is ok)
# - then edit the 3 "useful" error tokens individually and remove closing tags on all lines # - then edit the 3 "useful" error tokens individually and remove closing tags on all lines
# - then filter again to remove all lines not edited (which will be the lines not starting A-Z) # - then filter again to remove all lines not edited (which will be the lines not starting A-Z)
errtext="$(_value "$pleskxml_prettyprint_result" \ errtext="$(
| grep '^ *<[a-z]\{1,\}>[^<]*<\/[a-z]\{1,\}> *$' \ _value "$pleskxml_prettyprint_result" |
| sed 's/^ *<status>/Status: /;s/^ *<errcode>/Error code: /;s/^ *<errtext>/Error text: /;s/<\/.*$//' \ grep '^ *<[a-z]\{1,\}>[^<]*<\/[a-z]\{1,\}> *$' |
| grep '^[A-Z]' sed 's/^ *<status>/Status: /;s/^ *<errcode>/Error code: /;s/^ *<errtext>/Error text: /;s/<\/.*$//' |
grep '^[A-Z]'
)" )"
fi fi
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment