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
Xiaowu Zhang
slapos.core
Commits
66990a19
Commit
66990a19
authored
Nov 28, 2011
by
Antoine Catton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modifying request in order to support renaming of root.
parent
3bffc8d2
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
207 additions
and
108 deletions
+207
-108
master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/HostingSubscription_requestRootSoftwareInstance.xml
..._slap/HostingSubscription_requestRootSoftwareInstance.xml
+130
-0
master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/person_slap_interface_workflow/scripts/Person_requestSoftwareInstance.xml
...rface_workflow/scripts/Person_requestSoftwareInstance.xml
+76
-107
master/bt5/vifib_slap/bt/revision
master/bt5/vifib_slap/bt/revision
+1
-1
No files found.
master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/HostingSubscription_requestRootSoftwareInstance.xml
0 → 100644
View file @
66990a19
<?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>
from DateTime import DateTime\n
\n
portal = context.getPortalObject()\n
cleanup_resource = portal.portal_preferences.getPreferredInstanceCleanupResource()\n
\n
sale_order_portal_type = "Sale Order"\n
sale_order_line_portal_type = "Sale Order Line"\n
hosting_subscription_portal_type = "Hosting Subscription"\n
if context.isRootSlave():\n
software_instance_portal_type = "Slave Instance"\n
else:\n
software_instance_portal_type = "Software Instance"\n
\n
# Mostly copy and paste from\n
# portal_workflow/person_slap_interface_workflow/scripts/Person_requestSoftwareInstance\n
request_software_instance = None\n
for si in context.portal_catalog(portal_type=software_instance_portal_type,\n
title=context.getTitle(), root_uid=context.getUid()):\n
try:\n
cleanup_delivery_line = si.Item_getInstancePackingListLine(cleanup_resource)\n
except ValueError:\n
request_software_instance = si\n
break\n
else:\n
if cleanup_delivery_line.getSimulationState() != \'delivered\':\n
request_software_instance = si\n
break\n
\n
if request_software_instance is None:\n
setup_service_relative_url = portal.portal_preferences.getPreferredInstanceSetupResource()\n
\n
request_software_instance = portal.getDefaultModule(portal_type=software_instance_portal_type).newContent(\n
portal_type=software_instance_portal_type,\n
source_reference=context.getSourceReference(),\n
title=context.getTitle(),\n
text_content=context.getTextContent(),\n
sla_xml=context.getSlaXml(),\n
activate_kw={\'tag\': tag},\n
**portal.Base_getNewSoftwareInstanceCoordinate()\n
)\n
request_software_instance.portal_workflow.doActionFor(request_software_instance, \'validate_action\')\n
context.setPredecessorValueList(\n
context.getPredecessorValueList() + [request_software_instance]\n
)\n
\n
if context.getRootState() == \'started\':\n
request_software_instance.startRequested()\n
elif context.getRootState() == \'stopped\':\n
request_software_instance.stopRequested()\n
else:\n
request_software_instance.edit(\n
text_content=context.getTextContent(),\n
source_reference=context.getSourceReference(),\n
sla_xml=context.getSlaXml(),\n
activate_kw={\'tag\': tag},\n
)\n
if context.getRootState() == \'started\':\n
request_software_instance.startRequested()\n
request_software_instance.activate(after_tag=tag).requestStartComputerPartition()\n
elif context.getRootState() == \'stopped\':\n
request_software_instance.stopRequested()\n
request_software_instance.activate(after_tag=tag).requestStopComputerPartition()\n
\n
return request_software_instance\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
tag=None
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
HostingSubscription_requestRootSoftwareInstance
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/person_slap_interface_workflow/scripts/Person_requestSoftwareInstance.xml
View file @
66990a19
...
@@ -93,46 +93,36 @@ for hs in portal.portal_catalog(\n
...
@@ -93,46 +93,36 @@ for hs in portal.portal_catalog(\n
try:\n
try:\n
cleanup_delivery_line = si.Item_getInstancePackingListLine(cleanup_resource)\n
cleanup_delivery_line = si.Item_getInstancePackingListLine(cleanup_resource)\n
except ValueError:\n
except ValueError:\n
request_
software_instance = si
\n
request_
hosting_subscription = hs
\n
break\n
break\n
else:\n
else:\n
if cleanup_delivery_line.getSimulationState() != \'delivered\':\n
if cleanup_delivery_line.getSimulationState() != \'delivered\':\n
request_
software_instance = si
\n
request_
hosting_subscription = hs
\n
break\n
break\n
\n
\n
if request_software_instance is None and request_hosting_subscription is None:\n
if (portal.portal_activities.countMessageWithTag(tag) >
0):\n
hosting_subscription_reference = "HOSTSUBS-%s" % context.getPortalObject().portal_ids\\\n
.generateNewId(id_group=\'slap_hosting_subscription_reference\', id_generator=\'uid\')\n
if (portal.portal_activities.countMessageWithTag(tag) >
0):\n
# The software instance is already under creation but can not be fetched from catalog\n
# The software instance is already under creation but can not be fetched from catalog\n
# As it is not possible to fetch informations, it is better to raise an error\n
# As it is not possible to fetch informations, it is better to raise an error\n
raise NotImplementedError(tag)\n
raise NotImplementedError(tag)\n
else:\n
\n
\n
if request_hosting_subscription is None:\n
hosting_subscription_reference = "HOSTSUBS-%s" % context.getPortalObject().portal_ids\\\n
.generateNewId(id_group=\'slap_hosting_subscription_reference\', id_generator=\'uid\')\n
setup_service_relative_url = portal.portal_preferences.getPreferredInstanceSetupResource()\n
setup_service_relative_url = portal.portal_preferences.getPreferredInstanceSetupResource()\n
\n
\n
software_instance = portal.getDefaultModule(portal_type=software_instance_portal_type).newContent(\n
portal_type=software_instance_portal_type,\n
source_reference=software_type,\n
title=software_title,\n
text_content=instance_xml,\n
sla_xml=sla_xml,\n
activate_kw={\'tag\': tag},\n
**portal.Base_getNewSoftwareInstanceCoordinate()\n
)\n
software_instance.portal_workflow.doActionFor(software_instance, \'validate_action\')\n
subscription = portal.getDefaultModule(portal_type=hosting_subscription_portal_type).newContent(\n
subscription = portal.getDefaultModule(portal_type=hosting_subscription_portal_type).newContent(\n
portal_type=hosting_subscription_portal_type,\n
portal_type=hosting_subscription_portal_type,\n
reference=hosting_subscription_reference,\n
reference=hosting_subscription_reference,\n
title=software_title,\n
title=software_title,\n
activate_kw={\'tag\': tag},\n
activate_kw={\'tag\': tag},\n
source_reference=software_type,\n
text_content=instance_xml,\n
sla_xml=sla_xml,\n
root_state=state,\n
software_release_url=software_release_url_string,\n
root_slave=is_slave,\n
)\n
)\n
subscription.setPredecessorValue(software_instance)\n
software_instance = subscription.HostingSubscription_requestRootSoftwareInstance(tag)\n
\n
if state == \'started\':\n
software_instance.startRequested()\n
elif state == \'stopped\':\n
software_instance.stopRequested()\n
\n
\n
software_release_document = context.portal_catalog.getResultValue(\n
software_release_document = context.portal_catalog.getResultValue(\n
portal_type=\'Software Release\',\n
portal_type=\'Software Release\',\n
...
@@ -186,40 +176,19 @@ if request_software_instance is None and request_hosting_subscription is None:\n
...
@@ -186,40 +176,19 @@ if request_software_instance is None and request_hosting_subscription is None:\n
\n
\n
# Find Computer partition\n
# Find Computer partition\n
# XXX Link subscript to open order\n
# XXX Link subscript to open order\n
elif request_software_instance is None:\n
if (portal.portal_activities.countMessageWithTag(tag) > 0):\n
# The software instance is already under creation but can not be fetched from catalog\n
# As it is not possible to fetch informations, it is better to raise an error\n
raise NotImplementedError(tag)\n
else:\n
setup_service_relative_url = portal.portal_preferences.getPreferredInstanceSetupResource()\n
\n
software_instance = portal.getDefaultModule(portal_type=software_instance_portal_type).newContent(\n
portal_type=software_instance_portal_type,\n
source_reference=software_type,\n
title=software_title,\n
text_content=instance_xml,\n
sla_xml=sla_xml,\n
activate_kw={\'tag\': tag},\n
**portal.Base_getNewSoftwareInstanceCoordinate()\n
)\n
software_instance.portal_workflow.doActionFor(software_instance, \'validate_action\')\n
request_hosting_subscription.setPredecessorValueList(\n
request_hosting_subscription.getPredecessorList() + [software_instance])\n
else:\n
else:\n
# Update existing software instance\n
# Update existing software instance\n
request_
software_instance
.edit(\n
request_
hosting_subscription
.edit(\n
text_content=instance_xml,\n
text_content=instance_xml,\n
source_reference=software_type,\n
source_reference=software_type,\n
sla_xml=sla_xml,\n
sla_xml=sla_xml,\n
root_state=state,\n
software_release_url=software_release_url_string,\n
root_slave=is_slave,\n
activate_kw={\'tag\': tag},\n
activate_kw={\'tag\': tag},\n
)\n
)\n
if state == \'started\':\n
requested_software_instance = request_hosting_subscription\\\n
request_software_instance.startRequested()\n
.HostingSubscription_requestRootSoftwareInstance(tag)\n
request_software_instance.activate(after_tag=tag).requestStartComputerPartition()\n
elif state == \'stopped\':\n
request_software_instance.stopRequested()\n
request_software_instance.activate(after_tag=tag).requestStopComputerPartition()\n
]]>
</string>
</value>
]]>
</string>
</value>
...
...
master/bt5/vifib_slap/bt/revision
View file @
66990a19
450
451
\ 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