Now errors in blockip related subcommands are ignored.
[toast/tdyndns.git] / bin / tdyndns_update
index 0667c87019e9c5346dd96ef8b733d158bf902441..8806c8af6fe92e789d1f21c6bd3b45ad94c3ae22 100755 (executable)
@@ -49,7 +49,7 @@ def nsupdate_add(fqdn, ttl, ip):
        """
        :param fqdn: Fully qualified domain name
        :param ip_family: A or AAAA
-       :raises an NsupdateError in case of errors."""
+       :raises an CalledProcessError in case of errors."""
        command = "update add {fqdn} {ttl} IN {ip_family} {ip}\n\n".format(fqdn=fqdn, ttl=ttl, ip_family=ipfamily_by_ip(ip), ip=ip)
        p = Popen(['nsupdate', '-l'], stdin=PIPE)
        p.communicate(command)
@@ -60,7 +60,7 @@ def nsupdate_delete(fqdn, ip_family):
        """
        :param fqdn: Fully qualified domain name
        :param ip_family: A or AAAA
-       :raises an NsupdateError in case of errors."""
+       :raises an CalledProcessError in case of errors."""
        command = "update delete {fqdn} {ip_family}\n\n".format(fqdn=fqdn, ip_family=ip_family)
        p = Popen(['nsupdate', '-l'], stdin=PIPE)
        p.communicate(command)
@@ -71,19 +71,21 @@ def nsupdate_delete(fqdn, ip_family):
 def blockip_whitelist_add(ip):
        """
        :param ip: ipv4 address
-       :raises a BlockipError 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 BlockipError 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):