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
1
Merge Requests
1
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
Romain Courteaud
slapos.core
Commits
1350e574
Commit
1350e574
authored
Sep 05, 2014
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Computer request software instance workflow
parent
42e72e67
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
400 additions
and
12 deletions
+400
-12
master/bt5/slapos_cloud/TestTemplateItem/testSlapOSCloudWorkflow.py
.../slapos_cloud/TestTemplateItem/testSlapOSCloudWorkflow.py
+225
-11
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/computer_slap_interface_workflow/scripts/Computer_requestSoftwareInstanceChange.xml
...rkflow/scripts/Computer_requestSoftwareInstanceChange.xml
+111
-0
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/computer_slap_interface_workflow/states/draft.xml
...orkflow/computer_slap_interface_workflow/states/draft.xml
+1
-0
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/computer_slap_interface_workflow/transitions/request_software_instance.xml
...erface_workflow/transitions/request_software_instance.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 @
1350e574
...
@@ -334,6 +334,220 @@ class TestSlapOSCoreComputerSlapInterfaceWorkflow(testSlapOSMixin):
...
@@ -334,6 +334,220 @@ class TestSlapOSCoreComputerSlapInterfaceWorkflow(testSlapOSMixin):
state
=
'available'
)
state
=
'available'
)
transaction
.
abort
()
transaction
.
abort
()
def
test_Computer_requestSoftwareInstance_returnHostingSubscription
(
self
):
self
.
_makePerson
()
self
.
computer
.
edit
(
source_administration
=
self
.
person_user
.
getRelativeUrl
())
self
.
tic
()
self
.
login
(
self
.
person_user
.
getReference
())
software_release
=
self
.
generateNewSoftwareReleaseUrl
()
software_title
=
"Test Software Instance from Computer"
software_type
=
"test"
instance_xml
=
"""<?xml version="1.0" encoding="utf-8"?>
<instance>
</instance>
"""
shared
=
True
state
=
"started"
computer
=
self
.
computer
expected_sla_xml
=
"""<?xml version='1.0' encoding='utf-8'?><instance>
<parameter id="computer_guid">%s</parameter>
</instance>
"""
%
computer
.
getReference
()
computer
.
requestSoftwareInstance
(
software_release
=
software_release
,
software_title
=
software_title
,
software_type
=
software_type
,
instance_xml
=
instance_xml
,
shared
=
shared
,
state
=
state
,
)
hosting_subscription
=
computer
.
REQUEST
.
get
(
'request_hosting_subscription'
)
self
.
assertEquals
(
"Hosting Subscription"
,
hosting_subscription
.
getPortalType
())
self
.
assertEquals
(
computer
.
getRelativeUrl
(),
hosting_subscription
.
getAggregateValue
().
getRelativeUrl
())
self
.
assertEquals
(
hosting_subscription
.
getSlaXml
(),
expected_sla_xml
)
self
.
assertEquals
(
hosting_subscription
.
getPredecessorValue
().
getSlaXml
(),
expected_sla_xml
)
def
test_Computer_requestSoftwareInstance_requiredParameter
(
self
):
self
.
_makePerson
()
self
.
computer
.
edit
(
source_administration
=
self
.
person_user
.
getRelativeUrl
())
self
.
tic
()
self
.
login
(
self
.
person_user
.
getReference
())
software_release
=
self
.
generateNewSoftwareReleaseUrl
()
software_title
=
"Test Software Instance from Computer"
software_type
=
"test"
instance_xml
=
"""<?xml version="1.0" encoding="utf-8"?>
<instance>
</instance>
"""
shared
=
True
state
=
"started"
computer
=
self
.
computer
self
.
assertRaises
(
TypeError
,
computer
.
requestSoftwareInstance
)
# software_release is mandatory
self
.
assertRaises
(
TypeError
,
computer
.
requestSoftwareInstance
,
software_title
=
software_title
,
software_type
=
software_type
,
instance_xml
=
instance_xml
,
shared
=
shared
,
state
=
state
,
)
# software_title is mandatory
self
.
assertRaises
(
TypeError
,
computer
.
requestSoftwareInstance
,
software_release
=
software_release
,
software_type
=
software_type
,
instance_xml
=
instance_xml
,
shared
=
shared
,
state
=
state
,
)
# software_type is mandatory
self
.
assertRaises
(
TypeError
,
computer
.
requestSoftwareInstance
,
software_release
=
software_release
,
software_title
=
software_title
,
instance_xml
=
instance_xml
,
shared
=
shared
,
state
=
state
,
)
# instance_xml is mandatory
self
.
assertRaises
(
TypeError
,
computer
.
requestSoftwareInstance
,
software_release
=
software_release
,
software_title
=
software_title
,
software_type
=
software_type
,
shared
=
shared
,
state
=
state
,
)
# shared is mandatory
self
.
assertRaises
(
TypeError
,
computer
.
requestSoftwareInstance
,
software_release
=
software_release
,
software_title
=
software_title
,
software_type
=
software_type
,
instance_xml
=
instance_xml
,
state
=
state
,
)
# state is mandatory
self
.
assertRaises
(
TypeError
,
computer
.
requestSoftwareInstance
,
software_release
=
software_release
,
software_title
=
software_title
,
software_type
=
software_type
,
instance_xml
=
instance_xml
,
shared
=
shared
,
)
def
test_Computer_requestSoftwareInstance_acceptedState
(
self
):
self
.
_makePerson
()
self
.
computer
.
edit
(
source_administration
=
self
.
person_user
.
getRelativeUrl
())
self
.
tic
()
self
.
login
(
self
.
person_user
.
getReference
())
software_release
=
self
.
generateNewSoftwareReleaseUrl
()
software_title
=
"Test Software Instance from Computer"
software_type
=
"test"
instance_xml
=
"""<?xml version="1.0" encoding="utf-8"?>
<instance>
</instance>
"""
shared
=
True
state
=
"started"
computer
=
self
.
computer
# Only started, stopped, destroyed
self
.
assertRaises
(
ValueError
,
computer
.
requestSoftwareInstance
,
software_release
=
software_release
,
software_title
=
software_title
,
software_type
=
software_type
,
instance_xml
=
instance_xml
,
shared
=
shared
,
state
=
"foo"
,
)
computer
.
requestSoftwareInstance
(
software_release
=
software_release
,
software_title
=
"Computer started Software Instance"
,
software_type
=
software_type
,
instance_xml
=
instance_xml
,
shared
=
shared
,
state
=
"started"
,
)
hosting_subscription
=
computer
.
REQUEST
.
get
(
'request_hosting_subscription'
)
self
.
assertEquals
(
"start_requested"
,
hosting_subscription
.
getSlapState
())
computer
.
requestSoftwareInstance
(
software_release
=
software_release
,
software_title
=
"Computer stopped Software Instance"
,
software_type
=
software_type
,
instance_xml
=
instance_xml
,
shared
=
shared
,
state
=
"stopped"
,
)
hosting_subscription
=
computer
.
REQUEST
.
get
(
'request_hosting_subscription'
)
self
.
assertEquals
(
"stop_requested"
,
hosting_subscription
.
getSlapState
())
computer
.
requestSoftwareInstance
(
software_release
=
software_release
,
software_title
=
"Computer destroyed Software Instance"
,
software_type
=
software_type
,
instance_xml
=
instance_xml
,
shared
=
shared
,
state
=
"destroyed"
,
)
hosting_subscription
=
computer
.
REQUEST
.
get
(
'request_hosting_subscription'
)
self
.
assertEquals
(
None
,
hosting_subscription
)
def
test_Computer_requestSoftwareInstance_duplicatedHostingSubscription
(
self
):
self
.
_makePerson
()
self
.
computer
.
edit
(
source_administration
=
self
.
person_user
.
getRelativeUrl
())
self
.
tic
()
self
.
login
(
self
.
person_user
.
getReference
())
software_release
=
self
.
generateNewSoftwareReleaseUrl
()
software_title
=
"Test Software Instance from Computer"
software_type
=
"test"
instance_xml
=
"""<?xml version="1.0" encoding="utf-8"?>
<instance>
</instance>
"""
shared
=
True
state
=
"started"
computer
=
self
.
computer
computer
.
requestSoftwareInstance
(
software_release
=
software_release
,
software_title
=
software_title
,
software_type
=
software_type
,
instance_xml
=
instance_xml
,
shared
=
shared
,
state
=
state
,
)
hosting_subscription
=
computer
.
REQUEST
.
get
(
'request_hosting_subscription'
)
transaction
.
commit
()
hosting_subscription2
=
hosting_subscription
.
Base_createCloneDocument
(
batch_mode
=
1
)
hosting_subscription2
.
validate
()
transaction
.
commit
()
self
.
tic
()
self
.
assertRaises
(
NotImplementedError
,
computer
.
requestSoftwareInstance
,
software_release
=
software_release
,
software_title
=
software_title
,
software_type
=
software_type
,
instance_xml
=
instance_xml
,
shared
=
shared
,
state
=
state
,
)
def
test_revokeCertificate
(
self
):
def
test_revokeCertificate
(
self
):
self
.
login
(
self
.
computer
.
getReference
())
self
.
login
(
self
.
computer
.
getReference
())
self
.
computer
.
generateCertificate
()
self
.
computer
.
generateCertificate
()
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/computer_slap_interface_workflow/scripts/Computer_requestSoftwareInstanceChange.xml
0 → 100644
View file @
1350e574
<?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
encoding=
"cdata"
>
<![CDATA[
computer = state_change[\'object\']\n
person = computer.getSourceAdministrationValue()\n
\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
software_release_url_string = kwargs[\'software_release\']\n
software_title = kwargs["software_title"]\n
software_type = kwargs["software_type"]\n
instance_xml = kwargs["instance_xml"]\n
is_slave = kwargs["shared"]\n
root_state = kwargs["state"]\n
except KeyError:\n
raise TypeError, "Computer_requestSoftwareInstance takes exactly 6 arguments"\n
\n
if person is None:\n
return\n
\n
sla_xml = """<?xml version=\'1.0\' encoding=\'utf-8\'?>
<instance>
\n
<parameter
id=
"computer_guid"
>
%s
</parameter>
\n
</instance>
\n
""" % computer.getReference()\n
\n
person.requestSoftwareInstance(\n
state=root_state,\n
software_release=software_release_url_string,\n
software_title=software_title,\n
software_type=software_type,\n
instance_xml=instance_xml,\n
sla_xml=sla_xml,\n
shared=is_slave\n
)\n
\n
hosting_subscription = context.REQUEST.get(\'request_hosting_subscription\', None)\n
if hosting_subscription is None:\n
return\n
\n
hosting_subscription.setAggregateValue(computer)\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>
Computer_requestSoftwareInstanceChange
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/computer_slap_interface_workflow/states/draft.xml
View file @
1350e574
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
<string>
generate_certificate
</string>
<string>
generate_certificate
</string>
<string>
report_computer_bang
</string>
<string>
report_computer_bang
</string>
<string>
request_computer_registration
</string>
<string>
request_computer_registration
</string>
<string>
request_software_instance
</string>
<string>
request_software_release
</string>
<string>
request_software_release
</string>
<string>
revoke_certificate
</string>
<string>
revoke_certificate
</string>
</tuple>
</tuple>
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/computer_slap_interface_workflow/transitions/request_software_instance.xml
0 → 100644
View file @
1350e574
<?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>
Computer_requestSoftwareInstanceChange
</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>
request_software_instance
</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 @
1350e574
323
324
\ No newline at end of file
\ 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