_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}!"
return1
return1
@ -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!"
return1;
return1
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}"
_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!"
return1;
return1
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}"