From 47d25b57610e647a5f34e88f341ac3b4361f328b Mon Sep 17 00:00:00 2001 From: gregor herrmann Date: Fri, 1 Jul 2016 14:58:29 +0200 Subject: [PATCH] play around with Popen until it works --- bin/tdyndns_update | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/bin/tdyndns_update b/bin/tdyndns_update index b43286e..ea15832 100755 --- a/bin/tdyndns_update +++ b/bin/tdyndns_update @@ -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) -- 2.39.5