Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
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
Cédric Le Ninivin
slapos.core
Commits
a2b29c76
Commit
a2b29c76
authored
Jan 15, 2014
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented backward compatibility for slaproxy older them 1.0.1
parent
a2a46783
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
2 deletions
+24
-2
slapos/slap/slap.py
slapos/slap/slap.py
+8
-2
slapos/slap/util.py
slapos/slap/util.py
+16
-0
No files found.
slapos/slap/slap.py
View file @
a2b29c76
...
@@ -42,6 +42,7 @@ import socket
...
@@ -42,6 +42,7 @@ import socket
import
ssl
import
ssl
import
urllib
import
urllib
import
urlparse
import
urlparse
from
util
import
xml2dict
from
xml.sax
import
saxutils
from
xml.sax
import
saxutils
import
zope.interface
import
zope.interface
...
@@ -520,7 +521,12 @@ class ComputerPartition(SlapRequester):
...
@@ -520,7 +521,12 @@ class ComputerPartition(SlapRequester):
return
getattr
(
self
,
'_parameter_dict'
,
None
)
or
{}
return
getattr
(
self
,
'_parameter_dict'
,
None
)
or
{}
def
getConnectionParameterDict
(
self
):
def
getConnectionParameterDict
(
self
):
return
getattr
(
self
,
'_connection_dict'
,
None
)
or
{}
connection_dict
=
getattr
(
self
,
'_connection_dict'
,
None
)
if
connection_dict
is
None
:
# XXX Backward compatibility for older slapproxy (<= 1.0.0)
connection_dict
=
xml2dict
(
getattr
(
self
,
'connection_xml'
,
''
))
return
connection_dict
or
{}
def
getSoftwareRelease
(
self
):
def
getSoftwareRelease
(
self
):
"""
"""
...
@@ -548,7 +554,7 @@ class ComputerPartition(SlapRequester):
...
@@ -548,7 +554,7 @@ class ComputerPartition(SlapRequester):
raise
NotFoundError
(
"%s not found"
%
key
)
raise
NotFoundError
(
"%s not found"
%
key
)
def
getConnectionParameter
(
self
,
key
):
def
getConnectionParameter
(
self
,
key
):
connection_dict
=
getattr
(
self
,
'_connection_dict'
,
None
)
or
{}
connection_dict
=
self
.
getConnectionParameterDict
()
if
key
in
connection_dict
:
if
key
in
connection_dict
:
return
connection_dict
[
key
]
return
connection_dict
[
key
]
else
:
else
:
...
...
slapos/slap/util.py
0 → 100644
View file @
a2b29c76
from
lxml
import
etree
def
xml2dict
(
xml
):
result_dict
=
{}
if
xml
is
not
None
and
xml
!=
''
:
tree
=
etree
.
fromstring
(
xml
.
encode
(
'utf-8'
))
for
element
in
tree
.
iter
(
tag
=
etree
.
Element
):
if
element
.
tag
==
'parameter'
:
key
=
element
.
get
(
'id'
)
value
=
result_dict
.
get
(
key
,
None
)
if
value
is
not
None
:
value
=
value
+
' '
+
element
.
text
else
:
value
=
element
.
text
result_dict
[
key
]
=
value
return
result_dict
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