remove python

This commit is contained in:
Vladimir Berezhnoy 2017-07-09 20:00:02 +03:00
parent 57d1db58db
commit a0df46258d

View File

@ -31,6 +31,7 @@ dns_yandex_rm() {
_PDD_credentials || exit 1 _PDD_credentials || exit 1
export _H1="PddToken: $PDD_Token" export _H1="PddToken: $PDD_Token"
record_id=$(pdd_get_record_id "${fulldomain}") record_id=$(pdd_get_record_id "${fulldomain}")
_debug "Result: $record_id"
curDomain="$(echo "${fulldomain}" | rev | cut -d . -f 1-2 | rev)" curDomain="$(echo "${fulldomain}" | rev | cut -d . -f 1-2 | rev)"
curSubdomain="$(echo "${fulldomain}" | rev | cut -d . -f 3- | rev)" curSubdomain="$(echo "${fulldomain}" | rev | cut -d . -f 3- | rev)"
@ -54,16 +55,10 @@ _PDD_credentials() {
pdd_get_record_id() { pdd_get_record_id() {
fulldomain="${1}" fulldomain="${1}"
curDomain="$(echo "${fulldomain}" | awk -F. '{printf("%s.%s\n",$(NF-1), $NF)}')" curDomain="$(echo "${fulldomain}" | rev | cut -d . -f 1-2 | rev)"
curSubdomain="$(echo "${fulldomain}" | rev | cut -d . -f 3- | rev)"
curUri="https://pddimp.yandex.ru/api2/admin/dns/list?domain=${curDomain}" curUri="https://pddimp.yandex.ru/api2/admin/dns/list?domain=${curDomain}"
curResult="$(_get "${curUri}")" curResult="$(_get "${curUri}" | _normalizeJson)"
echo "${curResult}" \ _debug "Result: $curResult"
| python -c " echo "$curResult" | grep -o "{[^{]*\"content\":[^{]*\"subdomain\":\"${curSubdomain}\"" | sed -n -e 's#.* "record_id": \(.*\),[^,]*#\1#p'
import sys, json;
rs=json.load(sys.stdin)[\"records\"]
for r in rs:
if r[\"fqdn\"]==\"${fulldomain}\":
print r[\"record_id\"]
exit
"
} }