Commit 4bbb6b8d authored by BAIRE Anthony's avatar BAIRE Anthony
Browse files

improve robustness in matching docker events

with swarm, we had:

2017-Apr-24 18:09:13 DEBUG    docker event b'{"from":"
node:worker1","Type":"network","Action":"disconnect","Actor":{"ID":"83192c2a09bee6e50fba8cc506b1870fb6d96438afe0a821541e00b43a7229be","Attributes":{"contain
er":"d89ab93f01cbde3e78ca2bfcc688656b15a3a664060ea85733f1497ea7531d58","name":"bridge","node.addr":"192.168.21.100:2375","node.id":"V24K:QBXP:VO3N:K2EV:M2MH:IRI4:FV7Z:LOTZ:GTTD:PDBS:SSO2:KHIG","node.ip":"192.168
.21.100","node.name":"worker1","type":"bridge"}},"time":1493050153,"timeNano":1493050153228713620,"node":{"Name":"worker1","Id":"V24K:QBXP:VO3N:K2EV:M2MH:IRI4:FV7Z:LOTZ:GTTD:PDBS:SSO2:KHIG","Addr":"192.168.21.10
0:2375","Ip":"192.168.21.100"}}'
2017-Apr-24 18:09:13 ERROR    docker watcher exception
Traceback (most recent call last):
  File "/opt/allgo-docker/controller.py", line 950, in _thread_func
      if event["status"] == "die":
      KeyError: 'status'
parent 76effd73
......@@ -947,7 +947,7 @@ class DockerWatcher:
log.debug("docker event %r", event_bytes)
event = json.loads(event_bytes.decode())
if event["status"] == "die":
if event.get("status") == "die":
cid = event["id"]
fut = self._futures.get(cid)
if fut is not None and not fut.done():
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment