Skip to content

Commit

Permalink
Updated output.
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisb86 committed Oct 18, 2022
1 parent e49d1e5 commit 85a02aa
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions nsupdate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ get_domain_info () {
## Check if xmllint is installed and use it.
if command -v xmllint > /dev/null 2>&1; then

## File name for tempory file to store the XML from API
tmp_file="${domain}_${record_type}_$(date +%s).xml"
## File name for temporary file to store the XML from API
tmp_file="${main_domain}_${record_type}_$(date +%s).xml" # ${main_domain} in case of wildcards in ${domain}

## Check if WAN_IP_COMMAND is set and use it for retrieving the IP
if [ "$WAN_IP_COMMAND" != "" ]; then
Expand Down Expand Up @@ -175,7 +175,7 @@ get_domain_info () {
</methodCall>"

## Get domain info from INWX API and save it to a temporary file
curl -s -X POST ${inwx_api} -H "Content-Type: application/xml" -d "${inwx_api_xml_info}" -o ${tmp_dir}/${tmp_file}
curl --silent --show-error --fail --output ${tmp_dir}/${tmp_file} -X POST ${inwx_api} -H "Content-Type: application/xml" -d "${inwx_api_xml_info}"

## Extract ID and IP from INWX data
inwx_domain_ip="$(xmllint --xpath ${inwx_api_xpath_ip} ${tmp_dir}/${tmp_file})"
Expand All @@ -200,11 +200,11 @@ get_domain_info () {
fi

if [ -z "$inwx_domain_ip" ]; then
chat 1 "Couldn't get current IP. please check the installation instructions."
chat 1 "Couldn't get current IP address for ${domain} [${record_type}]. please check the installation instructions."
fi

if [ -z "$inwx_domain_id" ]; then
chat 1 "Couldn't find domain ID. please check the installation instructions."
chat 1 "Couldn't find domain ID for ${domain} [${record_type}]. please check the installation instructions."
fi
}

Expand Down Expand Up @@ -261,7 +261,7 @@ update_record () {
</params>
</methodCall>"

curl -s -X POST "${inwx_api}" -H "Content-Type: application/xml" -d "${inwx_api_xml_update_record}"
curl --silent --output /dev/null --show-error --fail -X POST "${inwx_api}" -H "Content-Type: application/xml" -d "${inwx_api_xml_update_record}"
}

## Initalize nsupdate
Expand Down

0 comments on commit 85a02aa

Please sign in to comment.