Fix string limit issue in _request_put_file 19/64119/1 v0.33.1
authorEric Ball <eball@linuxfoundation.org>
Thu, 28 May 2020 15:22:42 +0000 (08:22 -0700)
committerEric Ball <eball@linuxfoundation.org>
Thu, 28 May 2020 15:22:42 +0000 (08:22 -0700)
Requests can't handle a put call for very large data objects. However, it
can accept the data as a file-like object instead, and the size issue will
not show up. Documented here: https://github.com/psf/requests/issues/2717.

Issue: IT-19717
Change-Id: I826d3fa2eebbd3ba0389a0d7042701b4389e406d
Signed-off-by: Eric Ball <eball@linuxfoundation.org>
lftools/deploy.py
releasenotes/notes/string-limit-fix-a04184d5280da421.yaml [new file with mode: 0644]

index 15d181c..a2875c2 100755 (executable)
@@ -156,7 +156,7 @@ def _request_put_file(url, file_to_upload, parameters=None):
         if parameters:
             resp = requests.put(url, data=parameters, files=files)
         else:
-            resp = requests.put(url, data=upload_file.read())
+            resp = requests.put(url, data=upload_file)
     except requests.exceptions.MissingSchema:
         raise requests.HTTPError("Not valid URL format. Check for https:// etc..: {}".format(url))
     except requests.exceptions.ConnectTimeout:
diff --git a/releasenotes/notes/string-limit-fix-a04184d5280da421.yaml b/releasenotes/notes/string-limit-fix-a04184d5280da421.yaml
new file mode 100644 (file)
index 0000000..5a68332
--- /dev/null
@@ -0,0 +1,6 @@
+---
+fixes:
+  - |
+    Requests can't handle a put call for very large data objects. However, it
+    can accept the data as a file-like object instead, and the size issue will
+    not show up. Documented here: https://github.com/psf/requests/issues/2717.