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
Ivan Tyagov
slapos.core
Commits
f01094f3
Commit
f01094f3
authored
Dec 12, 2012
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Slaptool now uses updateConnection transition.
Each call will now be reported by the consumption API.
parent
07720848
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
14 deletions
+48
-14
master/bt5/slapos_slap_tool/TestTemplateItem/testSlapOSSlapTool.py
...5/slapos_slap_tool/TestTemplateItem/testSlapOSSlapTool.py
+46
-12
master/bt5/slapos_slap_tool/bt/revision
master/bt5/slapos_slap_tool/bt/revision
+1
-1
master/product/Vifib/Tool/SlapTool.py
master/product/Vifib/Tool/SlapTool.py
+1
-1
No files found.
master/bt5/slapos_slap_tool/TestTemplateItem/testSlapOSSlapTool.py
View file @
f01094f3
...
...
@@ -1006,6 +1006,14 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
self
.
assertEqual
(
expected_xml
,
got_xml
,
'
\
n
'
.
join
([
q
for
q
in
difflib
.
unified_diff
(
expected_xml
.
split
(
'
\
n
'
),
got_xml
.
split
(
'
\
n
'
))]))
def
assertInstanceUpdateConnectionSimulator
(
self
,
args
,
kwargs
):
stored
=
eval
(
open
(
self
.
instance_update_connection_simulator
).
read
())
# do the same translation magic as in workflow
kwargs
[
'connection_xml'
]
=
kwargs
.
pop
(
'connection_xml'
)
self
.
assertEqual
(
stored
,
[{
'recargs'
:
args
,
'reckwargs'
:
kwargs
,
'recmethod'
:
'updateConnection'
}])
def
test_setConnectionXml_withSlave
(
self
):
self
.
_makeComplexComputer
(
with_slave
=
True
)
partition_id
=
self
.
start_requested_software_instance
.
getAggregateValue
(
...
...
@@ -1019,13 +1027,26 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
<string>v2</string>
</dictionary>
</marshal>"""
stored_xml
=
"""<?xml version='1.0' encoding='utf-8'?>
<instance>
<parameter id="p2">v2</parameter>
<parameter id="p1">v1</parameter>
</instance>
"""
self
.
login
(
self
.
start_requested_software_instance
.
getReference
())
response
=
self
.
portal_slap
.
setComputerPartitionConnectionXml
(
self
.
computer_id
,
partition_id
,
connection_xml
,
slave_reference
)
self
.
instance_update_connection_simulator
=
tempfile
.
mkstemp
()[
1
]
try
:
self
.
start_requested_slave_instance
.
updateConnection
=
Simulator
(
self
.
instance_update_connection_simulator
,
'updateConnection'
)
response
=
self
.
portal_slap
.
setComputerPartitionConnectionXml
(
self
.
computer_id
,
partition_id
,
connection_xml
,
slave_reference
)
self
.
assertEqual
(
'None'
,
response
)
self
.
assertEqual
({
'p2'
:
'v2'
,
'p1'
:
'v1'
},
self
.
start_requested_slave_instance
.
getConnectionXmlAsDict
()
)
self
.
assertInstanceUpdateConnectionSimulator
((),
{
'connection_xml'
:
stored_xml
})
finally
:
if
os
.
path
.
exists
(
self
.
instance_update_connection_simulator
):
os
.
unlink
(
self
.
instance_update_connection_simulator
)
def
test_setConnectionXml
(
self
):
self
.
_makeComplexComputer
()
...
...
@@ -1039,13 +1060,26 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
<string>v2</string>
</dictionary>
</marshal>"""
stored_xml
=
"""<?xml version='1.0' encoding='utf-8'?>
<instance>
<parameter id="p2">v2</parameter>
<parameter id="p1">v1</parameter>
</instance>
"""
self
.
login
(
self
.
start_requested_software_instance
.
getReference
())
response
=
self
.
portal_slap
.
setComputerPartitionConnectionXml
(
self
.
computer_id
,
partition_id
,
connection_xml
)
self
.
instance_update_connection_simulator
=
tempfile
.
mkstemp
()[
1
]
try
:
self
.
start_requested_software_instance
.
updateConnection
=
Simulator
(
self
.
instance_update_connection_simulator
,
'updateConnection'
)
response
=
self
.
portal_slap
.
setComputerPartitionConnectionXml
(
self
.
computer_id
,
partition_id
,
connection_xml
)
self
.
assertEqual
(
'None'
,
response
)
self
.
assertEqual
({
'p2'
:
'v2'
,
'p1'
:
'v1'
},
self
.
start_requested_software_instance
.
getConnectionXmlAsDict
()
)
self
.
assertInstanceUpdateConnectionSimulator
((),
{
'connection_xml'
:
stored_xml
})
finally
:
if
os
.
path
.
exists
(
self
.
instance_update_connection_simulator
):
os
.
unlink
(
self
.
instance_update_connection_simulator
)
def
test_softwareInstanceError
(
self
):
self
.
_makeComplexComputer
()
...
...
master/bt5/slapos_slap_tool/bt/revision
View file @
f01094f3
18
\ No newline at end of file
19
\ No newline at end of file
master/product/Vifib/Tool/SlapTool.py
View file @
f01094f3
...
...
@@ -1023,7 +1023,7 @@ class SlapTool(BaseTool):
xml_declaration
=
True
,
encoding
=
'utf-8'
)
reference
=
software_instance
.
getReference
()
if
self
.
_getLastData
(
reference
)
!=
connection_xml
:
software_instance
.
edit
(
software_instance
.
updateConnection
(
connection_xml
=
connection_xml
,
)
self
.
_storeLastData
(
reference
,
connection_xml
)
...
...
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