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
Xiaowu Zhang
slapos.toolbox
Commits
a7930478
Commit
a7930478
authored
Feb 06, 2014
by
Nicolas Wavrant
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
resiliency-tests: new function for runner to get rcode through monitoring interface
parent
03eb928c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
1 deletion
+37
-1
slapos/resiliencytest/suites/slaprunner.py
slapos/resiliencytest/suites/slaprunner.py
+37
-1
No files found.
slapos/resiliencytest/suites/slaprunner.py
View file @
a7930478
...
...
@@ -169,6 +169,41 @@ class SlaprunnerTestSuite(ResiliencyTestSuite):
data
=
'path=workspace/slapos/software/%s/'
%
software_name
)
def
_getRcode
(
self
):
from
HTMLParser
import
HTMLParser
class
MyHTMLParser
(
HTMLParser
):
def
__init__
(
self
):
HTMLParser
.
__init__
(
self
)
self
.
recovery_code
=
""
self
.
attributes
=
None
def
handle_starttag
(
self
,
tag
,
attrs
):
print
"Encountered a start tag:"
,
tag
,
" with attrs:"
,
attrs
for
at
,
val
in
attrs
:
if
at
==
"name"
and
val
==
"recovery-code"
:
self
.
attributes
=
attrs
def
getRcode
(
self
):
if
type
(
self
.
attributes
)
==
list
:
for
attr
,
val
in
self
.
attributes
:
if
attr
==
"value"
:
return
val
else
:
return
""
#XXX-Nicolas: hardcoded url. Best way right now to automate the tests...
monitor_url
=
self
.
monitor_url
+
"?script=zero-knowledge%2Fsettings.cgi"
result
=
self
.
_opener_director
.
open
(
monitor_url
,
"password=passwordtochange"
)
if
result
.
getcode
()
is
not
200
:
raise
NotHttpOkException
(
result
.
getcode
())
page
=
result
.
read
().
strip
()
parser
=
MyHTMLParser
()
parser
.
feed
(
page
)
return
parser
.
getRcode
def
generateData
(
self
):
self
.
slaprunner_password
=
''
.
join
(
...
...
@@ -191,7 +226,8 @@ class SlaprunnerTestSuite(ResiliencyTestSuite):
parameter_dict
=
self
.
_getPartitionParameterDict
()
self
.
slaprunner_backend_url
=
parameter_dict
[
'backend_url'
]
self
.
logger
.
info
(
'backend_url is %s.'
%
self
.
slaprunner_backend_url
)
slaprunner_recovery_code
=
parameter_dict
[
'password_recovery_code'
]
self
.
monitor_url
=
parameter_dict
[
'monitor_url'
]
slaprunner_recovery_code
=
self
.
_getRcode
()
self
.
logger
.
debug
(
'Creating the slaprunner account...'
)
self
.
_connectToSlaprunner
(
...
...
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