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

Not working anymore with docker registry 2 ? #11

Open
kheraud opened this issue Aug 12, 2016 · 1 comment
Open

Not working anymore with docker registry 2 ? #11

kheraud opened this issue Aug 12, 2016 · 1 comment

Comments

@kheraud
Copy link

kheraud commented Aug 12, 2016

I see exceptions raised by docker-hook for every single action I do with my registry.

Exception happened during processing of request from ('127.0.0.1', 41065)
Traceback (most recent call last):
  File "/usr/lib/python2.7/SocketServer.py", line 295, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/usr/lib/python2.7/SocketServer.py", line 321, in process_request
    self.finish_request(request, client_address)
  File "/usr/lib/python2.7/SocketServer.py", line 334, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python2.7/SocketServer.py", line 655, in __init__
    self.handle()
  File "/usr/lib/python2.7/BaseHTTPServer.py", line 340, in handle
    self.handle_one_request()
  File "/usr/lib/python2.7/BaseHTTPServer.py", line 328, in handle_one_request
    method()
  File "/usr/local/bin/docker-hook", line 40, in do_POST
    for var, val in json_params['repository'].items())
KeyError: 'repository'

This issue comes from the fact that docker-hook expects the POSTed Json to contain a single event. Digging in the code, it seems that nothing is built to handle "grouped" events ({events: [...]})

Docker doc for registry notifications states:

While events may be sent in the same envelope, the set of events within that envelope have no implied relationship. For example, the registry may choose to group unrelated events and send them in the same envelope to reduce the total number of requests.

I am wondering if the script is made to be used with docker registry 2 (private registry) ?

@stixes
Copy link

stixes commented Feb 22, 2018

If any data is included, that does not parse as JSON, the json parser will throw this exception. I made a pull-request with a fix for this (pr #16).

yasaricli added a commit to yasaricli/docker-hook that referenced this issue Jan 13, 2021
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

2 participants