2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-31 14:05:33 +00:00

catch keyerror when trying to remove a non-existent zone

git-svn-id: svn://bind10.isc.org/svn/bind10/branches/f2f200910@294 e5f2f494-b856-4b98-b285-d166d9295462
This commit is contained in:
Jelte Jansen
2009-11-04 18:10:31 +00:00
parent 3d98d44233
commit 488453a9a3

View File

@@ -65,8 +65,13 @@ class ConfigManager:
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":