Project

General

Profile

Actions

Bug #8320

closed

acme: dns_yandex plugin is broken at least on amd64 platform due to different sed behavior

Added by Artem Tambovskiy over 7 years ago. Updated over 7 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
Category:
ACME
Target version:
-
Start date:
02/06/2018
Due date:
% Done:

0%

Estimated time:
Plus Target Version:
Affected Version:
2.4.2_1
Affected Plus Version:
Affected Architecture:
amd64

Description

The plugin dns_yandex is broken due to to different sed behavior.

The error resides within PDD_get_domain() function
_PDD_get_domain() {
fulldomain="${1}"
__page=1
__last=0
while [ $
_last -eq 0 ]; do
uri1="https://pddimp.yandex.ru/api2/admin/domain/domains?page=${__page}&on_page=20"
res1=$(get "$uri1" | _normalizeJson)
#_debug "$res1"
__found=$(echo "$res1" | sed -n -e 's#.* "found": \([^,]*\),.*#\1#p')
_debug "found: $
_found results on page"
if [ "$__found" -lt 20 ]; then
debug "last page: $_page"
__last=1
fi

_all_domains="$_all_domains $(echo "$res1" | sed -e "s@,\n@g" | grep '"name"' | cut -d: -f2 | sed -e 's"@@g')" 
_page=$(_math $_page + 1)
done

as we are trying to parse JSON response with sed -e "s@,\n@g" (replacing commas with sed) which just doesn't work on the FREEBSD version (see attached file).
The suggestion is to replace sed -e "s
,@\n@g" with a tr -s ',' '\n' which works just fine both on FREEBSD and linux platforms.


Files

dns_yandex.sed.test.case.txt (2.14 KB) dns_yandex.sed.test.case.txt Artem Tambovskiy, 02/06/2018 09:17 AM
Actions

Also available in: Atom PDF