From 27505f0b9fbe9374f244748de64e544f6cdcaec9 Mon Sep 17 00:00:00 2001 From: Jan Pazdziora Date: Mon, 3 Sep 2018 11:50:51 +0200 Subject: [PATCH] The status might not have containerID. Addressing 2018-01-03 15:59:15 - server - Handler failed: KeyError(u'containerID',) Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/custodia/httpd/server.py", line 351, in handle_one_request response = self.pipeline(self.server.config, request) File "/usr/lib/python2.7/site-packages/custodia/httpd/server.py", line 450, in pipeline valid = authzers[authz].handle(request) File "/usr/lib/python2.7/site-packages/custodia/openshift/authz.py", line 83, in handle pod = self.find_pod(pods, containerid) File "/usr/lib/python2.7/site-packages/custodia/openshift/authz.py", line 68, in find_pod if status[u'containerID'] == containerid: KeyError: u'containerID' --- src/custodia/openshift/authz.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/custodia/openshift/authz.py b/src/custodia/openshift/authz.py index 23a2ff4..bd0f026 100644 --- a/src/custodia/openshift/authz.py +++ b/src/custodia/openshift/authz.py @@ -65,7 +65,7 @@ def get_pods(self): def find_pod(self, data, containerid): for pod in data['items']: for status in pod[u'status'][u'containerStatuses']: - if status[u'containerID'] == containerid: + if u'containerID' in status and status[u'containerID'] == containerid: return pod def handle(self, request):