Browse Source

Fix CI issues

pull/1134/head
speedmann 7 years ago
parent
commit
a8202d4b37
  1. 38
      dnsapi/dns_inwx.sh

38
dnsapi/dns_inwx.sh

@ -35,10 +35,8 @@ dns_inwx_add() {
fi fi
_debug _sub_domain "$_sub_domain" _debug _sub_domain "$_sub_domain"
_debug _domain "$_domain" _debug _domain "$_domain"
_debug "Getting txt records" _debug "Getting txt records"
printf -v xml_content '<?xml version="1.0" encoding="UTF-8"?> printf -v xml_content '<?xml version="1.0" encoding="UTF-8"?>
<methodCall> <methodCall>
<methodName>nameserver.info</methodName> <methodName>nameserver.info</methodName>
@ -68,21 +66,21 @@ dns_inwx_add() {
</value> </value>
</param> </param>
</params> </params>
</methodCall>' $_domain $_sub_domain
</methodCall>' "$_domain" "$_sub_domain"
response="$(_post "$xml_content" "$INWX_Api" "" "POST")" response="$(_post "$xml_content" "$INWX_Api" "" "POST")"
if ! printf "%s" "$response" | grep "Command completed successfully" > /dev/null; then
if ! printf "%s" "$response" | grep "Command completed successfully" >/dev/null; then
_err "Error could net get txt records" _err "Error could net get txt records"
return 1 return 1
fi fi
if ! printf "%s" "$response" | grep "count" -q; then if ! printf "%s" "$response" | grep "count" -q; then
_info "Adding record" _info "Adding record"
_inwx_add_record $_domain $_sub_domain $txtvalue
_inwx_add_record "$_domain" "$_sub_domain" "$txtvalue"
else else
_record_id=$(printf '%s' $response | sed -nE 's/.*(<member><name>record){1}(.*)(<name>id<\/name><value><int>)([0-9]+){1}.*/\4/p')
_record_id=$(printf '%s' "$response" | sed -nE 's/.*(<member><name>record){1}(.*)(<name>id<\/name><value><int>)([0-9]+){1}.*/\4/p')
_info "Updating record" _info "Updating record"
_inwx_update_record $_record_id $txtvalue
_inwx_update_record "$_record_id" "$txtvalue"
fi fi
} }
@ -117,7 +115,6 @@ dns_inwx_rm() {
_debug "Getting txt records" _debug "Getting txt records"
printf -v xml_content '<?xml version="1.0" encoding="UTF-8"?> printf -v xml_content '<?xml version="1.0" encoding="UTF-8"?>
<methodCall> <methodCall>
<methodName>nameserver.info</methodName> <methodName>nameserver.info</methodName>
@ -147,10 +144,10 @@ dns_inwx_rm() {
</value> </value>
</param> </param>
</params> </params>
</methodCall>' $_domain $_sub_domain
</methodCall>' "$_domain" "$_sub_domain"
response="$(_post "$xml_content" "$INWX_Api" "" "POST")" response="$(_post "$xml_content" "$INWX_Api" "" "POST")"
if ! printf "%s" "$response" | grep "Command completed successfully" > /dev/null; then
if ! printf "%s" "$response" | grep "Command completed successfully" >/dev/null; then
_err "Error could not get txt records" _err "Error could not get txt records"
return 1 return 1
fi fi
@ -158,12 +155,11 @@ dns_inwx_rm() {
if ! printf "%s" "$response" | grep "count" -q; then if ! printf "%s" "$response" | grep "count" -q; then
_info "Do not need to delete record" _info "Do not need to delete record"
else else
_record_id=$(printf '%s' $response | sed -nE 's/.*(<member><name>record){1}(.*)(<name>id<\/name><value><int>)([0-9]+){1}.*/\4/p')
_record_id=$(printf '%s' "$response" | sed -nE 's/.*(<member><name>record){1}(.*)(<name>id<\/name><value><int>)([0-9]+){1}.*/\4/p')
_info "Deleting record" _info "Deleting record"
_inwx_delete_record $_record_id
_inwx_delete_record "$_record_id"
fi fi
} }
#################### Private functions below ################################## #################### Private functions below ##################################
@ -209,8 +205,8 @@ _get_root() {
i=2 i=2
p=1 p=1
export _H1=$(_inwx_login)
_H1=$(_inwx_login)
export _H1
printf -v xml_content '<?xml version="1.0" encoding="UTF-8"?> printf -v xml_content '<?xml version="1.0" encoding="UTF-8"?>
<methodCall> <methodCall>
<methodName>nameserver.list</methodName> <methodName>nameserver.list</methodName>
@ -256,7 +252,7 @@ _inwx_delete_record() {
</value> </value>
</param> </param>
</params> </params>
</methodCall>' $record_id
</methodCall>' "$record_id"
response="$(_post "$xml_content" "$INWX_Api" "" "POST")" response="$(_post "$xml_content" "$INWX_Api" "" "POST")"
@ -266,7 +262,6 @@ _inwx_delete_record() {
fi fi
return 0 return 0
} }
_inwx_update_record() { _inwx_update_record() {
@ -295,8 +290,7 @@ _inwx_update_record() {
</value> </value>
</param> </param>
</params> </params>
</methodCall>' $txtval $record_id
</methodCall>' "$txtval" "$record_id"
response="$(_post "$xml_content" "$INWX_Api" "" "POST")" response="$(_post "$xml_content" "$INWX_Api" "" "POST")"
@ -314,10 +308,6 @@ _inwx_add_record() {
sub_domain=$2 sub_domain=$2
txtval=$3 txtval=$3
_debug domain: $domain
_debug value: $txtval
_debug subd: $sub_domain
printf -v xml_content '<?xml version="1.0" encoding="UTF-8"?> printf -v xml_content '<?xml version="1.0" encoding="UTF-8"?>
<methodCall> <methodCall>
<methodName>nameserver.createRecord</methodName> <methodName>nameserver.createRecord</methodName>
@ -353,7 +343,7 @@ _inwx_add_record() {
</value> </value>
</param> </param>
</params> </params>
</methodCall>' $domain $txtval $sub_domain
</methodCall>' "$domain" "$txtval" "$sub_domain"
response="$(_post "$xml_content" "$INWX_Api" "" "POST")" response="$(_post "$xml_content" "$INWX_Api" "" "POST")"

Loading…
Cancel
Save