Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.toolbox
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Lu Xu
slapos.toolbox
Commits
55f21858
Commit
55f21858
authored
Apr 21, 2022
by
Thomas Gambier
Committed by
Thomas Gambier
Apr 25, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
resiliencytest: supports python3
parent
ca3341d5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
4 deletions
+5
-4
slapos/resiliencytest/suites/slaprunner.py
slapos/resiliencytest/suites/slaprunner.py
+3
-2
slapos/runner/views.py
slapos/runner/views.py
+2
-2
No files found.
slapos/resiliencytest/suites/slaprunner.py
View file @
55f21858
...
@@ -36,6 +36,7 @@ import random
...
@@ -36,6 +36,7 @@ import random
import
ssl
import
ssl
import
string
import
string
import
time
import
time
from
slapos.util
import
bytes2str
,
str2bytes
from
six.moves.urllib.request
import
HTTPCookieProcessor
,
HTTPSHandler
,
\
from
six.moves.urllib.request
import
HTTPCookieProcessor
,
HTTPSHandler
,
\
build_opener
build_opener
from
six.moves.urllib.error
import
HTTPError
from
six.moves.urllib.error
import
HTTPError
...
@@ -89,7 +90,7 @@ class SlaprunnerTestSuite(ResiliencyTestSuite):
...
@@ -89,7 +90,7 @@ class SlaprunnerTestSuite(ResiliencyTestSuite):
try
:
try
:
url
=
"%s/%s"
%
(
self
.
slaprunner_backend_url
,
resource
)
url
=
"%s/%s"
%
(
self
.
slaprunner_backend_url
,
resource
)
if
data
:
if
data
:
result
=
self
.
_opener_director
.
open
(
url
,
data
=
data
)
result
=
self
.
_opener_director
.
open
(
url
,
data
=
str2bytes
(
data
)
)
else
:
else
:
result
=
self
.
_opener_director
.
open
(
url
)
result
=
self
.
_opener_director
.
open
(
url
)
...
@@ -102,7 +103,7 @@ class SlaprunnerTestSuite(ResiliencyTestSuite):
...
@@ -102,7 +103,7 @@ class SlaprunnerTestSuite(ResiliencyTestSuite):
def
_login
(
self
):
def
_login
(
self
):
self
.
logger
.
debug
(
'Logging in...'
)
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
=
[
self
.
_opener_director
.
addheaders
=
[
(
'Authorization'
,
'Basic %s'
%
b64string
),
(
'Authorization'
,
'Basic %s'
%
b64string
),
# By default we will prefer to receive JSON to simplify
# By default we will prefer to receive JSON to simplify
...
...
slapos/runner/views.py
View file @
55f21858
...
@@ -244,13 +244,13 @@ def viewLog():
...
@@ -244,13 +244,13 @@ def viewLog():
return
render_template
(
'viewLog.html'
)
return
render_template
(
'viewLog.html'
)
def
getFileLog
():
def
getFileLog
():
logfile
=
request
.
form
.
get
(
'filename'
,
''
)
.
encode
(
'utf-8'
)
logfile
=
request
.
form
.
get
(
'filename'
,
''
)
if
logfile
==
"instance.log"
:
if
logfile
==
"instance.log"
:
file_path
=
app
.
config
[
'instance_log'
]
file_path
=
app
.
config
[
'instance_log'
]
elif
logfile
==
"software.log"
:
elif
logfile
==
"software.log"
:
file_path
=
app
.
config
[
'software_log'
]
file_path
=
app
.
config
[
'software_log'
]
else
:
else
:
file_path
=
realpath
(
app
.
config
,
logfile
)
file_path
=
realpath
(
app
.
config
,
logfile
.
encode
(
'utf-8'
)
)
try
:
try
:
if
not
os
.
path
.
exists
(
file_path
):
if
not
os
.
path
.
exists
(
file_path
):
raise
IOError
raise
IOError
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment