<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Tue, Nov 20, 2018 at 7:49 PM Richard W.M. Jones <<a href="mailto:rjones@redhat.com">rjones@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Tue, Nov 20, 2018 at 05:04:15PM +0000, Richard W.M. Jones wrote:<br>
> >From 9aca67b9875ab31bea7f3aeec411dad3ed990f17 Mon Sep 17 00:00:00 2001<br>
> From: "Richard W.M. Jones" <<a href="mailto:rjones@redhat.com" target="_blank">rjones@redhat.com</a>><br>
> Date: Tue, 20 Nov 2018 17:00:33 +0000<br>
> Subject: [PATCH] v2v: -o rhv-upload: Fix test so it doesn't fail if<br>
>  Content-Length header missing.<br>
> <br>
> If the Content-Length header was missing from the headers returned by<br>
> the server then the test would fail with:<br>
> <br>
> KeyError: 'content-length'<br>
> <br>
> This happens on RHEL 7.6 in particular.  We can fix this by using an<br>
> alternate method to fetch the header, which will return None instead<br>
> of throwing an exception if the header doesn't exist.  See:<br>
> <a href="https://stackoverflow.com/a/19255675" rel="noreferrer" target="_blank">https://stackoverflow.com/a/19255675</a><br>
> ---<br>
>  v2v/test-v2v-o-rhv-upload-module/ovirtsdk4/__init__.py | 2 +-<br>
>  1 file changed, 1 insertion(+), 1 deletion(-)<br>
> <br>
> diff --git a/v2v/test-v2v-o-rhv-upload-module/ovirtsdk4/__init__.py b/v2v/test-v2v-o-rhv-upload-module/ovirtsdk4/__init__.py<br>
> index 84b9d56aa..8d1058d67 100644<br>
> --- a/v2v/test-v2v-o-rhv-upload-module/ovirtsdk4/__init__.py<br>
> +++ b/v2v/test-v2v-o-rhv-upload-module/ovirtsdk4/__init__.py<br>
> @@ -146,7 +146,7 @@ class RequestHandler(BaseHTTPRequestHandler):<br>
>          self.end_headers()<br>
>  <br>
>      def discard_request(self):<br>
> -        length = self.headers['Content-Length']<br>
> +        length = self.headers.get('Content-Length')<br>
>          if length:<br>
>              length = int(length)<br>
>              content = self.rfile.read(length)<br>
> -- <br>
> 2.19.0.rc0<br></blockquote><div><br></div><div>Looks fine.</div><div><br></div><div>Nir</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
FYI I have tested this patch on Fedora 29 & RHEL 7 and the test now<br>
succeeds on both.  Previously the test failed on RHEL 7.<br>
<br>
Rich.<br>
<br>
-- <br>
Richard Jones, Virtualization Group, Red Hat <a href="http://people.redhat.com/~rjones" rel="noreferrer" target="_blank">http://people.redhat.com/~rjones</a><br>
Read my programming and virtualization blog: <a href="http://rwmj.wordpress.com" rel="noreferrer" target="_blank">http://rwmj.wordpress.com</a><br>
virt-top is 'top' for virtual machines.  Tiny program with many<br>
powerful monitoring features, net stats, disk stats, logging, etc.<br>
<a href="http://people.redhat.com/~rjones/virt-top" rel="noreferrer" target="_blank">http://people.redhat.com/~rjones/virt-top</a><br>
</blockquote></div></div>