Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12:Update
salt.10418
change-stringio-import-in-python2-to-import-the...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File change-stringio-import-in-python2-to-import-the-clas.patch of Package salt.10418
From a3db44678c1f6c72a83ed3c1d86f97ce25115830 Mon Sep 17 00:00:00 2001 From: Florian Bergmann <bergmannf@users.noreply.github.com> Date: Tue, 11 Sep 2018 14:03:33 +0200 Subject: [PATCH] Change StringIO import in python2 to import the class. (#107) Instead of using StringIO in python3, use the correct BytesIO class instead. --- salt/modules/hashutil.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/salt/modules/hashutil.py b/salt/modules/hashutil.py index 721957973d..5123cc7cd7 100644 --- a/salt/modules/hashutil.py +++ b/salt/modules/hashutil.py @@ -17,9 +17,10 @@ import salt.utils.hashutils import salt.utils.stringutils if six.PY2: - import StringIO + from StringIO import StringIO + BytesIO = StringIO elif six.PY3: - from io import StringIO + from io import BytesIO, StringIO def digest(instr, checksum='md5'): @@ -155,13 +156,13 @@ def base64_encodefile(fname): salt '*' hashutil.base64_encodefile /path/to/binary_file ''' - encoded_f = StringIO.StringIO() + encoded_f = BytesIO() with salt.utils.files.fopen(fname, 'rb') as f: base64.encode(f, encoded_f) encoded_f.seek(0) - return encoded_f.read() + return salt.utils.stringutils.to_str(encoded_f.read()) def base64_decodestring(instr): @@ -192,7 +193,7 @@ def base64_decodefile(instr, outfile): salt '*' hashutil.base64_decodefile instr='Z2V0IHNhbHRlZAo=' outfile='/path/to/binary_file' ''' - encoded_f = StringIO.StringIO(instr) + encoded_f = StringIO(instr) with salt.utils.files.fopen(outfile, 'wb') as f: base64.decode(encoded_f, f) -- 2.18.0
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor