[svn] commit: r294 - /branches/f2f200910/src/lib/bind-cfgd/python/bind-cfgd.py

BIND 10 source code commits bind10-changes at lists.isc.org
Wed Nov 4 18:10:32 UTC 2009


Author: jelte
Date: Wed Nov  4 18:10:31 2009
New Revision: 294

Log:
catch keyerror when trying to remove a non-existent zone

Modified:
    branches/f2f200910/src/lib/bind-cfgd/python/bind-cfgd.py

Modified: branches/f2f200910/src/lib/bind-cfgd/python/bind-cfgd.py
==============================================================================
--- branches/f2f200910/src/lib/bind-cfgd/python/bind-cfgd.py (original)
+++ branches/f2f200910/src/lib/bind-cfgd/python/bind-cfgd.py Wed Nov  4 18:10:31 2009
@@ -65,8 +65,13 @@
                     self.add_zone(cmd[2])
                     answer["result"] = [ 0 ]
                 elif cmd[0] == "zone" and cmd[1] == "remove":
-                    self.remove_zone(cmd[2])
-                    answer["result"] = [ 0 ]
+                    try:
+                        self.remove_zone(cmd[2])
+                        answer["result"] = [ 0 ]
+                    except KeyError:
+                        # zone wasn't there, should we make
+                        # a separate exception for that?
+                        answer["result"] = [ 1, "Unknown zone" ]
                 elif cmd[0] == "zone" and cmd[1] == "list":
                     answer["result"]     = list(self.config.zones.keys())
                 elif len(cmd) > 1 and cmd[1] == "shutdown":




More information about the bind10-changes mailing list