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