Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError: u'containerID' on OpenShift 3.7 #1

Open
adelton opened this issue Jan 3, 2018 · 1 comment
Open

KeyError: u'containerID' on OpenShift 3.7 #1

adelton opened this issue Jan 3, 2018 · 1 comment

Comments

@adelton
Copy link

adelton commented Jan 3, 2018

In some situations I see custodia configured with custodia.openshift to fail with

2018-01-03 15:59:15 - ContainerAuth-[auth:container]   - Detected docker://6e3578420cc82950272a5a479e48222be99e9f9a35104a24751124dbcdd6e630 for pid 102522
2018-01-03 15:59:15 - SimplePathAuthz-[authz:paths]    - PASS: '102522' authorized for '/secrets'
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'

It seems the code in find_pod cycles containerStatuses but assumes that containerID has to be present.

I haven't seen my tests fail with OpenShift 3.6 but with 3.7, I've started to get the above traceback, so maybe in 3.7 containerID can be missing? Or perhaps with 3.6 I was just lucky. In any case, the code should likely check for containerID existence.

@adelton
Copy link
Author

adelton commented Sep 3, 2018

I see this with OCP 3.9 as well, even if not in deterministic fashion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant