diff options
| author | Prasanna Kumar Kalever <prasanna.kalever@redhat.com> | 2020-04-03 20:06:48 +0530 |
|---|---|---|
| committer | Prasanna Kumar Kalever <prasanna.kalever@redhat.com> | 2020-04-03 23:58:23 +0530 |
| commit | 4f6611ed208b6029b4523ca7760a802e82b6a199 (patch) | |
| tree | b93a3961b8323239967029c2dd60112179d69dcb /scripts | |
| parent | 18ce78b530f01807b2f061e821b9329357bc5e02 (diff) | |
| download | targetcli-4f6611ed208b6029b4523ca7760a802e82b6a199.tar.gz | |
Use temp file objects for temporary storage area
happen to see yet another issue after we switch to stringIO/bytesIO:
$ targetcli ls
'unicode' does not have the buffer interface
After which I felt like dealing with StringIO/BytesIO is like a
wild goose chase and we are after all attempting to deal with python
incompatible apis.
Technically speaking, the rtslib and configshell libraries are expecting a
string IO stream, but then for python2 with ByteIO() we are passing a
bytestream, and stringIO() is behaving a bit different in python2 than
expected as explained in my previous patch.
Lets simply switch to temporary file in the most secure manner possible,
opening files in string mode will assure the compatibility across the platforms.
At the end we wish to have a consistent behaviour across all python versions.
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/targetcli | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/scripts/targetcli b/scripts/targetcli index 04e5aba..f11ece4 100755 --- a/scripts/targetcli +++ b/scripts/targetcli @@ -154,8 +154,9 @@ def call_daemon(shell, req): # get the actual data in chunks while amount_received < amount_expected: data = sock.recv(1024) + data = data.decode() amount_received += len(data) - print(data.decode(), end ="") + print(data, end ="") sock.send(b'-END@OF@DATA-') sock.close() |
