Browse Source

Formating of the script based of shfmt

Previous version failed at acme.sh on shfmt.
pull/3165/head
mxtuma 4 years ago
committed by GitHub
parent
commit
ecbc48466f
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 15
      dnsapi/dns_wedos.sh

15
dnsapi/dns_wedos.sh

@ -102,7 +102,6 @@ dns_wedos_rm() {
_saveaccountconf_mutable WEDOS_Authtoken "${WEDOS_Authtoken}" _saveaccountconf_mutable WEDOS_Authtoken "${WEDOS_Authtoken}"
fi fi
if ! _get_root "${fulldomain}"; then if ! _get_root "${fulldomain}"; then
_err "WEDOS Account do not contain primary domain to fullfill add of ${fulldomain}!" _err "WEDOS Account do not contain primary domain to fullfill add of ${fulldomain}!"
return 1 return 1
@ -120,7 +119,6 @@ dns_wedos_rm() {
fi fi
fi fi
_err "Requested dns row were not found or was imposible to delete it, do it manually" _err "Requested dns row were not found or was imposible to delete it, do it manually"
_err "Delete: ${fulldomain}" _err "Delete: ${fulldomain}"
_err "Value: ${txtvalue}" _err "Value: ${txtvalue}"
@ -187,7 +185,6 @@ _wapi_post() {
return "$?" return "$?"
} }
# _get_root() function, for provided full domain, like _acme_challenge.www.example.com verify if WEDOS contains a primary active domain and found what is subdomain # _get_root() function, for provided full domain, like _acme_challenge.www.example.com verify if WEDOS contains a primary active domain and found what is subdomain
# $1 - full domain to verify, ie _acme_challenge.www.example.com # $1 - full domain to verify, ie _acme_challenge.www.example.com
# build ${_domain} found at WEDOS, like example.com and ${_sub_domain} from provided full domain, like _acme_challenge.www # build ${_domain} found at WEDOS, like example.com and ${_sub_domain} from provided full domain, like _acme_challenge.www
@ -196,7 +193,7 @@ _get_root() {
if [ -z "${domain}" ]; then if [ -z "${domain}" ]; then
_err "Function _get_root was called without argument, implementation error!" _err "Function _get_root was called without argument, implementation error!"
return 1;
return 1
fi fi
_debug "Get root for domain: ${domain}" _debug "Get root for domain: ${domain}"
@ -210,8 +207,7 @@ _get_root() {
_debug "DNS list were successfully retrieved, response : ${response}" _debug "DNS list were successfully retrieved, response : ${response}"
fi fi
for xml_domain in $(echo "${response}" | tr -d '\012\015' | grep -o -E "<domain>( )*<name>.*</name>( )*<type>primary</type>( )*<status>active</status>" | grep -o -E "<name>.*</name>")
do
for xml_domain in $(echo "${response}" | tr -d '\012\015' | grep -o -E "<domain>( )*<name>.*</name>( )*<type>primary</type>( )*<status>active</status>" | grep -o -E "<name>.*</name>"); do
_debug "Active and primary XML DOMAIN found: ${xml_domain}" _debug "Active and primary XML DOMAIN found: ${xml_domain}"
end_of_name=$((${#xml_domain} - 7)) end_of_name=$((${#xml_domain} - 7))
xml_domain_name=$(echo "${xml_domain}" | cut -c 7-${end_of_name}) xml_domain_name=$(echo "${xml_domain}" | cut -c 7-${end_of_name})
@ -239,7 +235,7 @@ _wapi_dns_commit() {
if [ -z "${domain}" ]; then if [ -z "${domain}" ]; then
_err "Invalid request to commit dns changes, domain is empty, implementation error!" _err "Invalid request to commit dns changes, domain is empty, implementation error!"
return 1;
return 1
fi fi
data=" <data>\ data=" <data>\
@ -268,7 +264,7 @@ _wapi_row_add() {
if [ -z "${domain}" ] || [ -z "${sub_domain}" ] || [ -z "${value}" ] || [ -z "${ttl}" ]; then if [ -z "${domain}" ] || [ -z "${sub_domain}" ] || [ -z "${value}" ] || [ -z "${ttl}" ]; then
_err "Invalid request to add record, domain: '${domain}', sub_domain: '${sub_domain}', value: '${value}' and ttl: '${ttl}', on of required input were not provided, implementation error!" _err "Invalid request to add record, domain: '${domain}', sub_domain: '${sub_domain}', value: '${value}' and ttl: '${ttl}', on of required input were not provided, implementation error!"
return 1;
return 1
fi fi
# Prepare data for request to WAPI # Prepare data for request to WAPI
@ -325,8 +321,7 @@ _wapi_find_row() {
_debug "Subdomain regex '${sub_domain_regex}'" _debug "Subdomain regex '${sub_domain_regex}'"
for xml_row in $(echo "${response}" | tr -d '\012\015' | grep -o -E "<row>( )*<ID>[0-9]*</ID>( )*<name>${sub_domain_regex}</name>( )*<ttl>[0-9]*</ttl>( )*<rdtype>TXT</rdtype>( )*<rdata>${value}</rdata>" | grep -o -e "<ID>[0-9]*</ID>")
do
for xml_row in $(echo "${response}" | tr -d '\012\015' | grep -o -E "<row>( )*<ID>[0-9]*</ID>( )*<name>${sub_domain_regex}</name>( )*<ttl>[0-9]*</ttl>( )*<rdtype>TXT</rdtype>( )*<rdata>${value}</rdata>" | grep -o -e "<ID>[0-9]*</ID>"); do
_debug "Found row in DNS with ID : ${xml_row}" _debug "Found row in DNS with ID : ${xml_row}"
_row_id=$(echo "${xml_row}" | grep -o -E "[0-9]*") _row_id=$(echo "${xml_row}" | grep -o -E "[0-9]*")
_info "WEDOS API: Found DNS row id ${_row_id} for domain ${domain}" _info "WEDOS API: Found DNS row id ${_row_id} for domain ${domain}"

Loading…
Cancel
Save