Python 3 fixes

String to Bytes compatibility.

Story: #2006258
Task: #35875
Change-Id: Id0ad0f3c644af52f41217105b249df78d0b722cc
(cherry picked from commit abc8f57055)
This commit is contained in:
Telles Nobrega 2019-07-25 17:19:02 -03:00 committed by Luigi Toscano
parent 7adbbd67d6
commit 1fa76ce666
2 changed files with 6 additions and 2 deletions

View File

@ -173,7 +173,7 @@ class SparkJobEngine(base_engine.JobEngine):
job_configs.get('configs', {})):
path = 'service/edp/resources/edp-spark-wrapper.jar'
name = 'builtin-%s.jar' % uuidutils.generate_uuid()
builtin_libs = [{'raw': files.get_file_text(path),
builtin_libs = [{'raw': files.try_get_file_text(path),
'name': name}]
uploaded_paths = []

View File

@ -276,7 +276,11 @@ def _get_http_client(host, port, proxy_command=None, gateway_host=None,
def _write_fl(sftp, remote_file, data):
write_data = paramiko.py3compat.StringIO(data)
try:
write_data = paramiko.py3compat.StringIO(data)
except TypeError:
write_data = paramiko.py3compat.BytesIO(data)
sftp.putfo(write_data, remote_file)