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
Thomas Leymonerie
slapos.core
Commits
43c06542
Commit
43c06542
authored
Feb 22, 2019
by
Bryton Lacquement
🚪
Committed by
Julien Muchembled
Mar 07, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prepare for xml-marshaller 1.0.2
parent
f143249d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
17 deletions
+17
-17
master/bt5/slapos_slap_tool/TestTemplateItem/portal_components/test.erp5.testSlapOSSlapTool.py
...ateItem/portal_components/test.erp5.testSlapOSSlapTool.py
+2
-2
master/product/Vifib/Tool/SlapTool.py
master/product/Vifib/Tool/SlapTool.py
+10
-14
slapos/proxy/views.py
slapos/proxy/views.py
+5
-1
No files found.
master/bt5/slapos_slap_tool/TestTemplateItem/portal_components/test.erp5.testSlapOSSlapTool.py
View file @
43c06542
...
...
@@ -1441,8 +1441,8 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
</marshal>"""
stored_xml
=
"""<?xml version='1.0' encoding='utf-8'?>
<instance>
<parameter id="p1é">v1é</parameter>
<parameter id="p2é">v2é</parameter>
<parameter id="p1é">v1é</parameter>
</instance>
"""
self
.
login
(
self
.
start_requested_software_instance
.
getUserId
())
...
...
@@ -1474,8 +1474,8 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
</marshal>"""
stored_xml
=
"""<?xml version='1.0' encoding='utf-8'?>
<instance>
<parameter id="p1é">v1é</parameter>
<parameter id="p2é">v2é</parameter>
<parameter id="p1é">v1é</parameter>
</instance>
"""
self
.
login
(
self
.
start_requested_software_instance
.
getUserId
())
...
...
master/product/Vifib/Tool/SlapTool.py
View file @
43c06542
...
...
@@ -45,10 +45,12 @@ import hashlib
import
time
from
Products.ERP5Type.tests.utils
import
DummyMailHostMixin
try
:
from
slapos.slap.slap
import
Computer
from
slapos.slap.slap
import
ComputerPartition
as
SlapComputerPartition
from
slapos.slap.slap
import
SoftwareInstance
from
slapos.slap.slap
import
SoftwareRelease
from
slapos.slap.slap
import
(
Computer
,
ComputerPartition
as
SlapComputerPartition
,
SoftwareInstance
,
SoftwareRelease
)
from
slapos.proxy.views
import
dict2xml
except
ImportError
:
# Do no prevent instance from starting
# if libs are not installed
...
...
@@ -64,6 +66,8 @@ except ImportError:
class
SoftwareRelease
:
def
__init__
(
self
):
raise
ImportError
def
dict2xml
(
dictionary
):
raise
ImportError
from
zLOG
import
LOG
,
INFO
import
xml_marshaller
...
...
@@ -1203,16 +1207,8 @@ class SlapTool(BaseTool):
computer_id
,
computer_partition_id
,
slave_reference
)
partition_parameter_kw
=
xml_marshaller
.
xml_marshaller
.
loads
(
connection_xml
)
instance
=
etree
.
Element
(
'instance'
)
for
parameter_id
,
parameter_value
in
partition_parameter_kw
.
iteritems
():
if
not
isinstance
(
parameter_value
,
unicode
):
parameter_value
=
str
(
parameter_value
)
etree
.
SubElement
(
instance
,
"parameter"
,
attrib
=
{
'id'
:
parameter_id
}).
text
=
parameter_value
connection_xml
=
etree
.
tostring
(
instance
,
pretty_print
=
True
,
xml_declaration
=
True
,
encoding
=
'utf-8'
)
connection_xml
=
dict2xml
(
xml_marshaller
.
xml_marshaller
.
loads
(
connection_xml
))
reference
=
software_instance
.
getReference
()
if
self
.
_getLastData
(
reference
)
!=
connection_xml
:
software_instance
.
updateConnection
(
...
...
slapos/proxy/views.py
View file @
43c06542
...
...
@@ -70,7 +70,11 @@ def xml2dict(xml):
def
dict2xml
(
dictionary
):
instance
=
etree
.
Element
(
'instance'
)
for
k
,
v
in
six
.
iteritems
(
dictionary
):
if
not
isinstance
(
v
,
six
.
string_types
):
if
isinstance
(
k
,
bytes
):
k
=
k
.
decode
(
'utf-8'
)
if
isinstance
(
v
,
bytes
):
v
=
v
.
decode
(
'utf-8'
)
elif
not
isinstance
(
v
,
six
.
text_type
):
v
=
str
(
v
)
etree
.
SubElement
(
instance
,
"parameter"
,
attrib
=
{
'id'
:
k
}).
text
=
v
...
...
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