Fix CI issues

This commit is contained in:
speedmann 2017-12-07 12:05:03 +01:00
parent 657334fb67
commit a8202d4b37

View File

@ -35,11 +35,9 @@ 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>
<params> <params>
@ -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,8 +115,7 @@ 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>
<params> <params>
@ -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 ##################################
@ -196,26 +192,26 @@ _inwx_login() {
</methodCall>' $INWX_User $INWX_Password </methodCall>' $INWX_User $INWX_Password
response="$(_post "$xml_content" "$INWX_Api" "" "POST")" response="$(_post "$xml_content" "$INWX_Api" "" "POST")"
printf "Cookie: %s" "$(grep "domrobot=" "$HTTP_HEADER" | grep "^Set-Cookie:" | _tail_n 1 | _egrep_o 'domrobot=[^;]*;' | tr -d ';')" printf "Cookie: %s" "$(grep "domrobot=" "$HTTP_HEADER" | grep "^Set-Cookie:" | _tail_n 1 | _egrep_o 'domrobot=[^;]*;' | tr -d ';')"
} }
_get_root() { _get_root() {
domain=$1 domain=$1
_debug "get root" _debug "get root"
domain=$1 domain=$1
i=2 i=2
p=1 p=1
_H1=$(_inwx_login)
export _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>
</methodCall>' </methodCall>'
response="$(_post "$xml_content" "$INWX_Api" "" "POST")" response="$(_post "$xml_content" "$INWX_Api" "" "POST")"
while true; do while true; do
h=$(printf "%s" "$domain" | cut -d . -f $i-100) h=$(printf "%s" "$domain" | cut -d . -f $i-100)
@ -256,17 +252,16 @@ _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")"
if ! printf "%s" "$response" | grep "Command completed successfully" >/dev/null; then if ! printf "%s" "$response" | grep "Command completed successfully" >/dev/null; then
_err "Error" _err "Error"
return 1 return 1
fi fi
return 0 return 0
} }
_inwx_update_record() { _inwx_update_record() {
@ -295,17 +290,16 @@ _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")"
if ! printf "%s" "$response" | grep "Command completed successfully" >/dev/null; then if ! printf "%s" "$response" | grep "Command completed successfully" >/dev/null; then
_err "Error" _err "Error"
return 1 return 1
fi fi
return 0 return 0
} }
_inwx_add_record() { _inwx_add_record() {
@ -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,10 +343,10 @@ _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")"
if ! printf "%s" "$response" | grep "Command completed successfully" >/dev/null; then if ! printf "%s" "$response" | grep "Command completed successfully" >/dev/null; then
_err "Error" _err "Error"
return 1 return 1