Commit 55f21858 authored by Thomas Gambier's avatar Thomas Gambier Committed by Thomas Gambier

resiliencytest: supports python3

parent ca3341d5
......@@ -36,6 +36,7 @@ import random
import ssl
import string
import time
from slapos.util import bytes2str, str2bytes
from six.moves.urllib.request import HTTPCookieProcessor, HTTPSHandler, \
build_opener
from six.moves.urllib.error import HTTPError
......@@ -89,7 +90,7 @@ class SlaprunnerTestSuite(ResiliencyTestSuite):
try:
url = "%s/%s" % (self.slaprunner_backend_url, resource)
if data:
result = self._opener_director.open(url, data=data)
result = self._opener_director.open(url, data=str2bytes(data))
else:
result = self._opener_director.open(url)
......@@ -102,7 +103,7 @@ class SlaprunnerTestSuite(ResiliencyTestSuite):
def _login(self):
self.logger.debug('Logging in...')
b64string = base64.encodestring('%s:%s' % (self.slaprunner_user, self.slaprunner_password))[:-1]
b64string = base64.b64encode(('%s:%s' % (self.slaprunner_user, self.slaprunner_password)).encode()).decode()
self._opener_director.addheaders = [
('Authorization', 'Basic %s' % b64string),
# By default we will prefer to receive JSON to simplify
......
......@@ -244,13 +244,13 @@ def viewLog():
return render_template('viewLog.html')
def getFileLog():
logfile = request.form.get('filename', '').encode('utf-8')
logfile = request.form.get('filename', '')
if logfile == "instance.log":
file_path = app.config['instance_log']
elif logfile == "software.log":
file_path = app.config['software_log']
else:
file_path = realpath(app.config, logfile)
file_path = realpath(app.config, logfile.encode('utf-8'))
try:
if not os.path.exists(file_path):
raise IOError
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment