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
Labels
Merge Requests
17
Merge Requests
17
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos.core
Commits
2a47befa
Commit
2a47befa
authored
Dec 12, 2012
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New transition to update the connection_xml.
parent
a490a99a
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
183 additions
and
1 deletion
+183
-1
master/bt5/slapos_cloud/TestTemplateItem/testSlapOSCloudWorkflow.py
.../slapos_cloud/TestTemplateItem/testSlapOSCloudWorkflow.py
+32
-0
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_updateConnectionInformation.xml
...scripts/RequestedInstance_updateConnectionInformation.xml
+85
-0
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/states/destroy_requested.xml
...ance_slap_interface_workflow/states/destroy_requested.xml
+1
-0
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/states/start_requested.xml
...stance_slap_interface_workflow/states/start_requested.xml
+1
-0
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/states/stop_requested.xml
...nstance_slap_interface_workflow/states/stop_requested.xml
+1
-0
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/transitions/update_connection.xml
...slap_interface_workflow/transitions/update_connection.xml
+62
-0
master/bt5/slapos_cloud/bt/revision
master/bt5/slapos_cloud/bt/revision
+1
-1
No files found.
master/bt5/slapos_cloud/TestTemplateItem/testSlapOSCloudWorkflow.py
View file @
2a47befa
...
...
@@ -4,6 +4,7 @@ from Products.SlapOS.tests.testSlapOSMixin import \
import
transaction
from
Products.ERP5Type.tests.backportUnittest
import
expectedFailure
from
Products.ERP5Type.Errors
import
UnsupportedWorkflowMethod
from
Products.DCWorkflow.DCWorkflow
import
ValidationFailed
from
AccessControl.SecurityManagement
import
getSecurityManager
,
\
setSecurityManager
...
...
@@ -1065,6 +1066,37 @@ class TestSlapOSCoreInstanceSlapInterfaceWorkflow(testSlapOSMixin):
)
transaction
.
abort
()
def
test_updateConnection
(
self
):
self
.
login
(
self
.
instance
.
getReference
())
request_kw
=
self
.
request_kw
.
copy
()
self
.
instance
.
requestStop
(
**
request_kw
)
connection_xml
=
self
.
generateSafeXml
()
self
.
instance
.
updateConnection
(
connection_xml
=
connection_xml
)
self
.
assertEquals
(
self
.
instance
.
getConnectionXml
(),
connection_xml
)
transaction
.
abort
()
def
test_updateConnectionRequired
(
self
):
self
.
login
(
self
.
instance
.
getReference
())
request_kw
=
self
.
request_kw
.
copy
()
self
.
instance
.
requestStop
(
**
request_kw
)
# No connection_xml
self
.
assertRaises
(
TypeError
,
self
.
instance
.
updateConnection
)
transaction
.
abort
()
def
test_updateConnectionBrokenXml
(
self
):
self
.
login
(
self
.
instance
.
getReference
())
request_kw
=
self
.
request_kw
.
copy
()
self
.
instance
.
requestStop
(
**
request_kw
)
# No connection_xml
self
.
assertRaises
(
ValidationFailed
,
self
.
instance
.
updateConnection
,
connection_xml
=
"<foo bar /<>"
)
transaction
.
abort
()
class
TestSlapOSCoreSoftwareInstanceRequest
(
testSlapOSMixin
):
"""Tests instance.requestInstance"""
def
afterSetUp
(
self
):
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_updateConnectionInformation.xml
0 → 100644
View file @
2a47befa
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
instance = state_change[\'object\']\n
portal = instance.getPortalObject()\n
# Get required arguments\n
kwargs = state_change.kwargs\n
\n
# Required args\n
# Raise TypeError if all parameters are not provided\n
try:\n
connection_xml = state_change.kwargs[\'connection_xml\']\n
except KeyError:\n
raise TypeError, "RequestedInstance_updateConnectionInformation takes exactly 1 arguments"\n
\n
edit_kw = {\n
\'connection_xml\': connection_xml,\n
}\n
\n
instance.edit(**edit_kw)\n
# Prevent storing broken XML in text content (which prevent to update parameters after)\n
context.Instance_checkConsistency(state_change)\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
state_change
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
RequestedInstance_updateConnectionInformation
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/states/destroy_requested.xml
View file @
2a47befa
...
...
@@ -26,6 +26,7 @@
<string>
report_computer_partition_error
</string>
<string>
request_instance
</string>
<string>
unallocate_partition
</string>
<string>
update_connection
</string>
</tuple>
</value>
</item>
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/states/start_requested.xml
View file @
2a47befa
...
...
@@ -30,6 +30,7 @@
<string>
request_instance
</string>
<string>
request_start
</string>
<string>
request_stop
</string>
<string>
update_connection
</string>
</tuple>
</value>
</item>
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/states/stop_requested.xml
View file @
2a47befa
...
...
@@ -30,6 +30,7 @@
<string>
request_instance
</string>
<string>
request_start
</string>
<string>
request_stop
</string>
<string>
update_connection
</string>
</tuple>
</value>
</item>
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/transitions/update_connection.xml
0 → 100644
View file @
2a47befa
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"TransitionDefinition"
module=
"Products.DCWorkflow.Transitions"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
actbox_category
</string>
</key>
<value>
<string>
workflow
</string>
</value>
</item>
<item>
<key>
<string>
actbox_icon
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
actbox_name
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
actbox_url
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
after_script_name
</string>
</key>
<value>
<string>
RequestedInstance_updateConnectionInformation
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
guard
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
update_connection
</string>
</value>
</item>
<item>
<key>
<string>
new_state_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
script_name
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
trigger_type
</string>
</key>
<value>
<int>
2
</int>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_cloud/bt/revision
View file @
2a47befa
262
\ No newline at end of file
263
\ No newline at end of file
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