>From 9aca67b9875ab31bea7f3aeec411dad3ed990f17 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 20 Nov 2018 17:00:33 +0000 Subject: [PATCH] v2v: -o rhv-upload: Fix test so it doesn't fail if Content-Length header missing. If the Content-Length header was missing from the headers returned by the server then the test would fail with: KeyError: 'content-length' This happens on RHEL 7.6 in particular. We can fix this by using an alternate method to fetch the header, which will return None instead of throwing an exception if the header doesn't exist. See: https://stackoverflow.com/a/19255675 --- v2v/test-v2v-o-rhv-upload-module/ovirtsdk4/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/v2v/test-v2v-o-rhv-upload-module/ovirtsdk4/__init__.py b/v2v/test-v2v-o-rhv-upload-module/ovirtsdk4/__init__.py index 84b9d56aa..8d1058d67 100644 --- a/v2v/test-v2v-o-rhv-upload-module/ovirtsdk4/__init__.py +++ b/v2v/test-v2v-o-rhv-upload-module/ovirtsdk4/__init__.py @@ -146,7 +146,7 @@ class RequestHandler(BaseHTTPRequestHandler): self.end_headers() def discard_request(self): - length = self.headers['Content-Length'] + length = self.headers.get('Content-Length') if length: length = int(length) content = self.rfile.read(length) -- 2.19.0.rc0