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
Titouan Soulard
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):
...
@@ -1441,8 +1441,8 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
</marshal>"""
</marshal>"""
stored_xml
=
"""<?xml version='1.0' encoding='utf-8'?>
stored_xml
=
"""<?xml version='1.0' encoding='utf-8'?>
<instance>
<instance>
<parameter id="p1é">v1é</parameter>
<parameter id="p2é">v2é</parameter>
<parameter id="p2é">v2é</parameter>
<parameter id="p1é">v1é</parameter>
</instance>
</instance>
"""
"""
self
.
login
(
self
.
start_requested_software_instance
.
getUserId
())
self
.
login
(
self
.
start_requested_software_instance
.
getUserId
())
...
@@ -1474,8 +1474,8 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
...
@@ -1474,8 +1474,8 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
</marshal>"""
</marshal>"""
stored_xml
=
"""<?xml version='1.0' encoding='utf-8'?>
stored_xml
=
"""<?xml version='1.0' encoding='utf-8'?>
<instance>
<instance>
<parameter id="p1é">v1é</parameter>
<parameter id="p2é">v2é</parameter>
<parameter id="p2é">v2é</parameter>
<parameter id="p1é">v1é</parameter>
</instance>
</instance>
"""
"""
self
.
login
(
self
.
start_requested_software_instance
.
getUserId
())
self
.
login
(
self
.
start_requested_software_instance
.
getUserId
())
...
...
master/product/Vifib/Tool/SlapTool.py
View file @
43c06542
...
@@ -45,10 +45,12 @@ import hashlib
...
@@ -45,10 +45,12 @@ import hashlib
import
time
import
time
from
Products.ERP5Type.tests.utils
import
DummyMailHostMixin
from
Products.ERP5Type.tests.utils
import
DummyMailHostMixin
try
:
try
:
from
slapos.slap.slap
import
Computer
from
slapos.slap.slap
import
(
from
slapos.slap.slap
import
ComputerPartition
as
SlapComputerPartition
Computer
,
from
slapos.slap.slap
import
SoftwareInstance
ComputerPartition
as
SlapComputerPartition
,
from
slapos.slap.slap
import
SoftwareRelease
SoftwareInstance
,
SoftwareRelease
)
from
slapos.proxy.views
import
dict2xml
except
ImportError
:
except
ImportError
:
# Do no prevent instance from starting
# Do no prevent instance from starting
# if libs are not installed
# if libs are not installed
...
@@ -64,6 +66,8 @@ except ImportError:
...
@@ -64,6 +66,8 @@ except ImportError:
class
SoftwareRelease
:
class
SoftwareRelease
:
def
__init__
(
self
):
def
__init__
(
self
):
raise
ImportError
raise
ImportError
def
dict2xml
(
dictionary
):
raise
ImportError
from
zLOG
import
LOG
,
INFO
from
zLOG
import
LOG
,
INFO
import
xml_marshaller
import
xml_marshaller
...
@@ -1203,16 +1207,8 @@ class SlapTool(BaseTool):
...
@@ -1203,16 +1207,8 @@ class SlapTool(BaseTool):
computer_id
,
computer_id
,
computer_partition_id
,
computer_partition_id
,
slave_reference
)
slave_reference
)
partition_parameter_kw
=
xml_marshaller
.
xml_marshaller
.
loads
(
connection_xml
=
dict2xml
(
xml_marshaller
.
xml_marshaller
.
loads
(
connection_xml
)
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'
)
reference
=
software_instance
.
getReference
()
reference
=
software_instance
.
getReference
()
if
self
.
_getLastData
(
reference
)
!=
connection_xml
:
if
self
.
_getLastData
(
reference
)
!=
connection_xml
:
software_instance
.
updateConnection
(
software_instance
.
updateConnection
(
...
...
slapos/proxy/views.py
View file @
43c06542
...
@@ -70,7 +70,11 @@ def xml2dict(xml):
...
@@ -70,7 +70,11 @@ def xml2dict(xml):
def
dict2xml
(
dictionary
):
def
dict2xml
(
dictionary
):
instance
=
etree
.
Element
(
'instance'
)
instance
=
etree
.
Element
(
'instance'
)
for
k
,
v
in
six
.
iteritems
(
dictionary
):
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
)
v
=
str
(
v
)
etree
.
SubElement
(
instance
,
"parameter"
,
etree
.
SubElement
(
instance
,
"parameter"
,
attrib
=
{
'id'
:
k
}).
text
=
v
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