X-Git-Url: https://git.toastfreeware.priv.at/toast/tdyndns.git/blobdiff_plain/47d25b57610e647a5f34e88f341ac3b4361f328b..9b41ba33482698fc20c521cb182a5207c3ec44b6:/bin/tdyndns_update diff --git a/bin/tdyndns_update b/bin/tdyndns_update index ea15832..8f943f8 100755 --- a/bin/tdyndns_update +++ b/bin/tdyndns_update @@ -2,7 +2,7 @@ import sys import re import argparse -from subprocess import Popen, PIPE +from subprocess import Popen, PIPE, call import ipaddr @@ -52,9 +52,9 @@ def blockip_whitelist_add(ip): :param ip: ipv4 address :raises a BlockipError in case of errors.""" command = "iptables -I blockip -s {ip} -j ACCEPT".format(ip=ip) - p = Popen(command, shell=True) - if p.returncode != 0: - raise NsupdateError(p.returncode) + p = call(command, shell=True) + if p != 0: + raise BlockipError(p) def blockip_whitelist_delete(ip): @@ -62,9 +62,9 @@ def blockip_whitelist_delete(ip): :param ip: ipv4 address :raises a BlockipError in case of errors.""" command = "iptables -D blockip -s {ip} -j ACCEPT".format(ip=ip) - p = Popen(command, shell=True) - if p.returncode != 0: - raise NsupdateError(p.returncode) + p = call(command, shell=True) + if p != 0: + raise BlockipError(p) def main(args):