]> ToastFreeware Gitweb - toast/tdyndns.git/blobdiff - bin/tdyndns_update
play around with Popen until it works
[toast/tdyndns.git] / bin / tdyndns_update
index b43286ed07cf3b1720994449205c80ba4adb7d8b..ea158328465cd7290c43473e93abc2d2a9f9e832 100755 (executable)
@@ -51,9 +51,8 @@ def blockip_whitelist_add(ip):
        """
        :param ip: ipv4 address
        :raises a BlockipError in case of errors."""
-       command = "-I blockip -s {ip} -j ACCEPT\n\n".format(ip=ip)
-       p = Popen(['iptables'], stdin=PIPE)
-       p.communicate(command)
+       command = "iptables -I blockip -s {ip} -j ACCEPT".format(ip=ip)
+       p = Popen(command, shell=True)
        if p.returncode != 0:
                raise NsupdateError(p.returncode)
 
@@ -62,9 +61,8 @@ def blockip_whitelist_delete(ip):
        """
        :param ip: ipv4 address
        :raises a BlockipError in case of errors."""
-       command = "-D blockip -s {ip} -j ACCEPT\n\n".format(ip=ip)
-       p = Popen(['iptables'], stdin=PIPE)
-       p.communicate(command)
+       command = "iptables -D blockip -s {ip} -j ACCEPT".format(ip=ip)
+       p = Popen(command, shell=True)
        if p.returncode != 0:
                raise NsupdateError(p.returncode)