Join GitHub today
Remove `+` character from platform releases string #895
There is an issue when pika is used within GCP(Google Cloud Platform) and following patch tries to fix that.
pika has a method
This is what one of the GCP vm instance returns when asked for platform information:
Steps to reproduce:
I couldn't figure out a way to reproduce this bug outside GCP, on my local machine etc. So, to reproduce this bug I think one needs an access to GCP. Create a VM instance and try above. I created a Kubernetes installation (which does the VMs installations too) and tried this. This platform information is also passed to Docker, hence my Docker containers are also failing.
Let me know if any information is needed. Or a better way to fix this.
@@ Coverage Diff @@ ## master #895 +/- ## ========================================== + Coverage 81.92% 81.96% +0.03% ========================================== Files 21 21 Lines 3752 3759 +7 Branches 554 555 +1 ========================================== + Hits 3074 3081 +7 Misses 527 527 Partials 151 151
Interesting, I expected the release to return a clean version string since that is what it shows in python documentation (https://docs.python.org/3/library/platform.html#platform.release).
As the LINUX_VERSION is only checked if python does not natively support TCP_USER_TIMEOUT, it might be bet to just wrap the contents of the function to a try-except and catch ValueError, then return None on exception. This might make old kernels with weird release strings disable the TCP_USER_TIMEOUT support, but that is probably preferable to completely blowing up pika with new kernels.
I'd offer a patch but I'm currently away from my dev machine, sorry ;)
Actually, looks like py-amqp has a solution for this: https://github.com/celery/py-amqp/blob/master/amqp/platform.py#L24
Edit: Also, py-amqp has had the exact same problem: celery/py-amqp#119