Now errors in blockip related subcommands are ignored. master
authorPhilipp Spitzer <philipp@spitzer.priv.at>
Wed, 7 Dec 2016 20:21:09 +0000 (21:21 +0100)
committerPhilipp Spitzer <philipp@spitzer.priv.at>
Wed, 7 Dec 2016 20:21:09 +0000 (21:21 +0100)
e.g. 'iptables: Bad rule (does a matching rule exist in that chain?).'

bin/tdyndns_update

index 27bfed0..8806c8a 100755 (executable)
@@ -71,19 +71,21 @@ def nsupdate_delete(fqdn, ip_family):
 def blockip_whitelist_add(ip):
        """
        :param ip: ipv4 address
-       :raises a CalledProcessError in case of errors."""
+       """
        if ipfamily_by_ip(ip) == 'A':
                command = ['iptables', '-I', 'blockip', '-s', str(ip), '-j', 'ACCEPT']
-               check_call(command)
+               p = Popen(command, stderr=PIPE)
+               stdout, stderr = p.communicate()
 
 
 def blockip_whitelist_delete(ip):
        """
        :param ip: ipv4 address
-       :raises a CalledProcessError in case of errors."""
+       """
        if ipfamily_by_ip(ip) == 'A':
                command = ['iptables', '-D', 'blockip', '-s', str(ip), '-j', 'ACCEPT']
-               check_call(command)
+               p = Popen(command, stderr=PIPE)
+               stdout, stderr = p.communicate()
 
 
 def main(args):