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
20
Merge Requests
20
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
slapos.core
Commits
6f1269c0
Commit
6f1269c0
authored
Sep 18, 2019
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos/master: Use XML<-->dict from slapos.util
parent
ff1099ca
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
11 deletions
+4
-11
master/product/Vifib/Tool/SlapTool.py
master/product/Vifib/Tool/SlapTool.py
+4
-11
No files found.
master/product/Vifib/Tool/SlapTool.py
View file @
6f1269c0
...
...
@@ -50,7 +50,7 @@ try:
ComputerPartition
as
SlapComputerPartition
,
SoftwareInstance
,
SoftwareRelease
)
from
slapos.
proxy.views
import
dict2xml
from
slapos.
slap.util
import
dict2xml
,
xml2dict
except
ImportError
:
# Do no prevent instance from starting
# if libs are not installed
...
...
@@ -68,6 +68,8 @@ except ImportError:
raise
ImportError
def
dict2xml
(
dictionary
):
raise
ImportError
def
xml2dict
(
dictionary
):
raise
ImportError
from
zLOG
import
LOG
,
INFO
import
xml_marshaller
...
...
@@ -896,16 +898,7 @@ class SlapTool(BaseTool):
def
_instanceXmlToDict
(
self
,
xml
):
result_dict
=
{}
try
:
if
xml
is
not
None
and
xml
!=
''
:
tree
=
etree
.
fromstring
(
xml
)
for
element
in
tree
.
findall
(
'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
result_dict
=
xml2dict
(
xml
)
except
(
etree
.
XMLSchemaError
,
etree
.
XMLSchemaParseError
,
etree
.
XMLSchemaValidateError
,
etree
.
XMLSyntaxError
):
LOG
(
'SlapTool'
,
INFO
,
'Issue during parsing xml:'
,
error
=
True
)
...
...
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