ctlmgr: do not raise exceptions in Controllers.__setitem__. Closes #1198

This commit is contained in:
Sebastien Bourdeauducq 2018-12-01 18:06:53 +08:00
parent 7f55376c75
commit fd00021a52
1 changed files with 11 additions and 7 deletions

View File

@ -178,6 +178,7 @@ class Controllers:
raise ValueError raise ValueError
def __setitem__(self, k, v): def __setitem__(self, k, v):
try:
if (isinstance(v, dict) and v["type"] == "controller" and if (isinstance(v, dict) and v["type"] == "controller" and
self.host_filter in get_ip_addresses(v["host"])): self.host_filter in get_ip_addresses(v["host"])):
v["command"] = v["command"].format(name=k, v["command"] = v["command"].format(name=k,
@ -185,6 +186,9 @@ class Controllers:
port=v["port"]) port=v["port"])
self.queue.put_nowait(("set", (k, v))) self.queue.put_nowait(("set", (k, v)))
self.active_or_queued.add(k) self.active_or_queued.add(k)
except:
logger.error("Failed to process device database entry %s", k,
exc_info=True)
def __delitem__(self, k): def __delitem__(self, k):
if k in self.active_or_queued: if k in self.active_or_queued: