diff --git a/dnsapi/dns_fmdns.sh b/dnsapi/dns_fmdns.sh index bcc2c3e8..08276c8b 100644 --- a/dnsapi/dns_fmdns.sh +++ b/dnsapi/dns_fmdns.sh @@ -94,14 +94,14 @@ _fmDnsApi_addRecord() { _info "Adding record to zone" curData="{\"fmAuthToken\":\"${FMDNS_API_TOKEN}\",\"id\":\"${FMDNS_API_DOMAIN_ID}\",\"action\":\"add\",\"name\":\"${fulldomain}\",\"value\":\"${txtvalue}\",\"type\":\"TXT\",\"ttl\":\"5\",\"reload\":\"yes\"}" curResult="$(_post "${curData}" "${FMDNS_API_ENDPOINT}")" - _info "API result: '${curResult}'" + _info "API $curResult" _debug "Calling facileManager API: '${curData}' '${FMDNS_API_ENDPOINT}'" _debug "Result of zone add: '$curResult'" - if [ "${curResult}" != "Success" ]; then - if [ -z "${curResult}" ]; then + if ! _contains "$curResult" 'Success'; then + if [ -z "$curResult" ]; then _err "Empty response" else - _err "${curResult}" + _err "$curResult" fi return 1 fi @@ -113,14 +113,14 @@ _fmDnsApi_removeRecord() { _info "Removing record from zone" curData="{\"fmAuthToken\":\"${FMDNS_API_TOKEN}\",\"id\":\"${FMDNS_API_DOMAIN_ID}\",\"action\":\"delete\",\"name\":\"${fulldomain}\",\"type\":\"TXT\",\"ttl\":\"5\",\"reload\":\"yes\"}" curResult="$(_post "${curData}" "${FMDNS_API_ENDPOINT}")" - _info "API result: '${curResult}'" + _info "API $curResult" _debug "Calling facileManager API: '${curData}' '${FMDNS_API_ENDPOINT}'" _debug "Result of zone delete: '$curResult'" - if [ "${curResult}" != "Success" ]; then - if [ -z "${curResult}" ]; then + if ! _contains "$curResult" 'Success'; then + if [ -z "$curResult" ]; then _err "Empty response" else - _err "${curResult}" + _err "$curResult" fi return 1 fi