diff --git a/spacewalk-abrt.spec b/spacewalk-abrt.spec index 951caa0794..83de6a7954 100644 --- a/spacewalk-abrt.spec +++ b/spacewalk-abrt.spec @@ -11,7 +11,7 @@ Name: spacewalk-abrt Version: 2.8.3 -Release: 4%{?dist} +Release: 5%{?dist} Summary: ABRT plug-in for rhn-check License: GPLv2 @@ -93,6 +93,10 @@ service abrtd restart %endif %changelog +* Fri Nov 02 2018 Tomas Kasparek 2.8.3-5 +- Resolves: #1623111 - use base64.encodebytes if possible + (tkasparek@redhat.com) + * Tue Mar 20 2018 Tomas Kasparek 2.8.3-4 - don't build python2 subpackages on systems with default python3 (tkasparek@redhat.com) diff --git a/src/spacewalk_abrt/abrt.py b/src/spacewalk_abrt/abrt.py index d1093a0209..283dea46af 100644 --- a/src/spacewalk_abrt/abrt.py +++ b/src/spacewalk_abrt/abrt.py @@ -29,6 +29,9 @@ from up2date_client import up2dateAuth from up2date_client import rhnserver from up2date_client import up2dateLog +encodestring = base64.encodestring +if hasattr(base64, 'encodebytes'): + encodestring = base64.encodebytes def _readline(filepath): firstline = None @@ -114,12 +117,12 @@ def report(problem_dir): crash_file_data = {'filename': os.path.basename(i), 'path': path, 'filesize': filesize, - 'filecontent': base64.encodestring(bstr("")), + 'filecontent': encodestring(bstr("")), 'content-encoding': 'base64'} if server.abrt.is_crashfile_upload_enabled(systemid) and filesize <= server.abrt.get_crashfile_uploadlimit(systemid): f = open(path, 'r') try: - crash_file_data['filecontent'] = base64.encodestring(bstr(f.read())) + crash_file_data['filecontent'] = encodestring(bstr(f.read())) finally: f.close()