Fix corrupted zip/image upload 57/13957/6
authorBengt Thuree <bthuree@linuxfoundation.org>
Fri, 18 Jan 2019 18:28:17 +0000 (05:28 +1100)
committerBengt Thuree <bthuree@linuxfoundation.org>
Sun, 20 Jan 2019 22:55:04 +0000 (09:55 +1100)
Change the parameter to requests.posts from files=files,
where files contained the file reference, to
data=file.read().

This was done, since with the previous configuration binary files were
corrupted during upload.

Change-Id: I85c68adc32e031c7f1f101e9d8bfcb5a7acb0670
Issue-Id: RELENG-1591
Signed-off-by: Bengt Thuree <bthuree@linuxfoundation.org>
lftools/deploy.py

index fe66663..51bba1b 100644 (file)
@@ -110,7 +110,7 @@ def _request_post_file(url, file_to_upload, parameters=None):
         if parameters:
             resp = requests.post(url, data=parameters, files=files)
         else:
-            resp = requests.post(url, files=files)
+            resp = requests.post(url, data=upload_file.read())
     except requests.exceptions.MissingSchema:
         raise requests.HTTPError("Not valid URL: {}".format(url))
     except requests.exceptions.ConnectionError: