From: Eric Ball Date: Thu, 28 May 2020 15:22:42 +0000 (-0700) Subject: Fix string limit issue in _request_put_file X-Git-Tag: v0.33.1^0 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F19%2F64119%2F1;p=releng%2Flftools.git Fix string limit issue in _request_put_file 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 --- diff --git a/lftools/deploy.py b/lftools/deploy.py index 15d181c2..a2875c20 100755 --- a/lftools/deploy.py +++ b/lftools/deploy.py @@ -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 index 00000000..5a68332f --- /dev/null +++ b/releasenotes/notes/string-limit-fix-a04184d5280da421.yaml @@ -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.