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
Gabriel Monnerat
slapos.toolbox
Commits
69a41bc8
Commit
69a41bc8
authored
May 27, 2016
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
webrunner resiliency test: fix get rcode from monitoring
parent
5fc07809
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
slapos/resiliencytest/suites/slaprunner.py
slapos/resiliencytest/suites/slaprunner.py
+10
-10
No files found.
slapos/resiliencytest/suites/slaprunner.py
View file @
69a41bc8
...
@@ -37,6 +37,7 @@ import ssl
...
@@ -37,6 +37,7 @@ import ssl
import
string
import
string
import
time
import
time
import
urllib2
import
urllib2
import
urllib
class
NotHttpOkException
(
Exception
):
class
NotHttpOkException
(
Exception
):
pass
pass
...
@@ -198,19 +199,18 @@ class SlaprunnerTestSuite(ResiliencyTestSuite):
...
@@ -198,19 +199,18 @@ class SlaprunnerTestSuite(ResiliencyTestSuite):
def
_getRcode
(
self
):
def
_getRcode
(
self
):
#XXX-Nicolas: hardcoded url. Best way right now to automate the tests...
#XXX-Nicolas: hardcoded url. Best way right now to automate the tests...
monitoring_password
=
"
passwordtochang
e"
monitoring_password
=
"
insecur
e"
monitor_url
=
self
.
monitor_url
+
"
?script=zero-knowledge%2Fsettings.cgi
"
monitor_url
=
self
.
monitor_url
+
"
/private/monitor.global.json
"
result
=
self
.
_opener_director
.
open
(
monitor_url
,
monitor_url
=
monitor_url
.
replace
(
'https://'
,
'https://admin:%s@'
%
monitoring_password
)
"password="
+
monitoring_password
+
";password_2="
+
monitoring_password
)
result
=
urllib
.
urlopen
(
monitor_url
)
if
result
.
getcode
()
is
not
200
:
if
result
.
getcode
()
is
not
200
:
raise
NotHttpOkException
(
result
.
getcode
())
raise
NotHttpOkException
(
result
.
getcode
())
page
=
result
.
read
().
strip
()
monitor_json
=
json
.
loads
(
result
.
read
())
html
=
etree
.
HTML
(
page
)
for
parameter
in
monitor_json
[
'parameters'
]:
if
parameter
[
'title'
]
==
'recovery-code'
:
input
=
html
.
xpath
(
"//input[@name='recovery-code']"
)
return
parameter
[
'value'
]
return
input
[
0
].
get
(
'value'
)
def
generateData
(
self
):
def
generateData
(
self
):
self
.
slaprunner_password
=
''
.
join
(
self
.
slaprunner_password
=
''
.
join
(
...
@@ -233,7 +233,7 @@ class SlaprunnerTestSuite(ResiliencyTestSuite):
...
@@ -233,7 +233,7 @@ class SlaprunnerTestSuite(ResiliencyTestSuite):
parameter_dict
=
self
.
_getPartitionParameterDict
()
parameter_dict
=
self
.
_getPartitionParameterDict
()
self
.
slaprunner_backend_url
=
parameter_dict
[
'backend_url'
]
self
.
slaprunner_backend_url
=
parameter_dict
[
'backend_url'
]
self
.
logger
.
info
(
'backend_url is %s.'
%
self
.
slaprunner_backend_url
)
self
.
logger
.
info
(
'backend_url is %s.'
%
self
.
slaprunner_backend_url
)
self
.
monitor_url
=
parameter_dict
[
'monitor
_backend_
url'
]
self
.
monitor_url
=
parameter_dict
[
'monitor
-base-
url'
]
slaprunner_recovery_code
=
self
.
_getRcode
()
slaprunner_recovery_code
=
self
.
_getRcode
()
self
.
logger
.
debug
(
'Creating the slaprunner account...'
)
self
.
logger
.
debug
(
'Creating the slaprunner account...'
)
...
...
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