gjcarneiro / yacron

A modern Cron replacement that is Docker-friendly
MIT License
454 stars 38 forks source link

Yacron HTTP server failing with: KeyError: "Key not found: 'Accept'" #45

Closed vcajes closed 3 years ago

vcajes commented 3 years ago

Description

The web listen config fails to parse requests coming from the kubernetes health checks.

What I Did

The yacron config

web:
  listen:
    - http://0.0.0.0:8072

The kubernetes healt check config:

        readinessProbe:
          httpGet:
            path: /status
            port: 8072
            scheme: HTTP

The output logs:

INFO:aiohttp.access:10.101.111.72 [22/Apr/2021:16:35:57 +0000] "GET /status HTTP/1.1" 500 244 "-" "kube-probe/1.19"
ERROR:aiohttp.server:Error handling request
Traceback (most recent call last):
  File "aiohttp/web_protocol.py", line 418, in start
  File "aiohttp/web_app.py", line 458, in _handle
  File "yacron/cron.py", line 182, in _web_get_status
  File "multidict/_multidict_py.py", line 74, in __getitem__
  File "multidict/_multidict_py.py", line 69, in getone
KeyError: "Key not found: 'Accept'"

Apparently it doesn't know how to pare the Accept header or something.

Thanks team!

gjcarneiro commented 3 years ago

Ah, yes, looking at the line in question, it is obvious that it would crash if the Accept header is missing. Is a simple fix.

vcajes commented 3 years ago

Awesome, thanks @gjcarneiro ! When are you planning to make a release binary with this fix included? This will allow use to with kubernetes :)

https://github.com/gjcarneiro/yacron/releases/

Thank you a lot! Great work on this project!

gjcarneiro commented 3 years ago

I made a new release 0.12.0.