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
491e37fd
Commit
491e37fd
authored
Sep 20, 2012
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Switch software releases for already instantiated instances.
parent
a27d3d9c
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
111 additions
and
31 deletions
+111
-31
master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/Base_getSoftwareReleaseDocument.xml
...rtal_skins/vifib_slap/Base_getSoftwareReleaseDocument.xml
+85
-0
master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/SaleOrderLine_tryToAssociateSoftwareRelease.xml
...ifib_slap/SaleOrderLine_tryToAssociateSoftwareRelease.xml
+1
-22
master/bt5/vifib_slap/bt/revision
master/bt5/vifib_slap/bt/revision
+1
-1
master/bt5/vifib_slapos_accounting/WorkflowTemplateItem/portal_workflow/instance_accounting_slap_interaction_workflow/scripts/Instance_changePromiseParameter.xml
...tion_workflow/scripts/Instance_changePromiseParameter.xml
+8
-3
master/bt5/vifib_slapos_accounting/WorkflowTemplateItem/portal_workflow/instance_accounting_slap_interaction_workflow/scripts/Instance_changePromiseState.xml
...eraction_workflow/scripts/Instance_changePromiseState.xml
+11
-2
master/bt5/vifib_slapos_accounting/WorkflowTemplateItem/portal_workflow/instance_accounting_slap_interaction_workflow/scripts/Instance_createSalePackingList.xml
...ction_workflow/scripts/Instance_createSalePackingList.xml
+4
-2
master/bt5/vifib_slapos_accounting/bt/revision
master/bt5/vifib_slapos_accounting/bt/revision
+1
-1
No files found.
master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/Base_getSoftwareReleaseDocument.xml
0 → 100644
View file @
491e37fd
<?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>
# try to find, if needed create and publish\n
portal = context.getPortalObject()\n
software_release_document = portal.portal_catalog.getResultValue(portal_type=\'Software Release\',\n
url_string=software_release_url)\n
if software_release_document is None:\n
digest = context.Base_getSha512Hexdiest(software_release_url)\n
tag = \'%s_inProgress\' % digest\n
if portal.portal_activities.countMessageWithTag(tag) == 0:\n
# can create new one\n
software_release_document = portal.software_release_module.newContent(\n
portal_type=\'Software Release\',\n
reference=digest,\n
version=digest,\n
url_string=software_release_url,\n
language=\'en\',\n
activate_kw={\'tag\': tag}\n
)\n
software_release_document.publish(comment=\'Automatically created.\')\n
return software_release_document\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
software_release_url
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Base_getSoftwareReleaseDocument
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/SaleOrderLine_tryToAssociateSoftwareRelease.xml
View file @
491e37fd
...
...
@@ -57,27 +57,6 @@ from zExceptions import Unauthorized\n
def markHistory(document, comment):\n
document.portal_workflow.doActionFor(document, action=\'edit_action\', comment=comment)\n
\n
def getSoftwareRelease(software_release_url):\n
# try to find, if needed create and publish\n
portal = context.getPortalObject()\n
software_release_document = portal.portal_catalog.getResultValue(portal_type=\'Software Release\',\n
url_string=software_release_url)\n
if software_release_document is None:\n
digest = context.Base_getSha512Hexdiest(software_release_url)\n
tag = \'%s_inProgress\' % digest\n
if portal.portal_activities.countMessageWithTag(tag) == 0:\n
# can create new one\n
software_release_document = portal.software_release_module.newContent(\n
portal_type=\'Software Release\',\n
reference=digest,\n
version=digest,\n
url_string=software_release_url,\n
language=\'en\',\n
activate_kw={\'tag\': tag}\n
)\n
software_release_document.publish()\n
return software_release_document\n
\n
state = context.getSimulationState()\n
portal = context.getPortalObject()\n
order = context.getParentValue()\n
...
...
@@ -89,7 +68,7 @@ if state in [\'planned\', \'ordered\']:\n
if line_software_release_document is not None:\n
line_software_release_url = line_software_release_document.getUrlString()\n
\n
software_release_document =
getSoftwareRelease
(instance_software_release_url)\n
software_release_document =
context.Base_getSoftwareReleaseDocument
(instance_software_release_url)\n
\n
if line_software_release_url == \'\' or \\\n
line_software_release_url != instance_software_release_url:\n
...
...
master/bt5/vifib_slap/bt/revision
View file @
491e37fd
806
\ No newline at end of file
807
\ No newline at end of file
master/bt5/vifib_slapos_accounting/WorkflowTemplateItem/portal_workflow/instance_accounting_slap_interaction_workflow/scripts/Instance_changePromiseParameter.xml
View file @
491e37fd
...
...
@@ -51,7 +51,6 @@
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
instance = state_change[\'object\']\n
\n
# Get latest workflow transition\n
state = instance.getSlapState()\n
started = "start_requested"\n
...
...
@@ -64,12 +63,18 @@ if (state in (started, stopped)):\n
delivery = instance.getCausalityValue(portal_type=["Sale Packing List"])\n
update_service_relative_url = portal.portal_preferences.getPreferredInstanceUpdateResource()\n
\n
software_release_document = instance.Base_getSoftwareReleaseDocument(instance.getRootSoftwareReleaseUrl())\n
if software_release_document is None:\n
raise NotImplemnetedError(\'Software Release %r not ready yet\' % instance.getRootSoftwareReleaseUrl())\n
if delivery is None:\n
new_delivery = context.Instance_createSalePackingList(state_change, portal.restrictedTraverse(update_service_relative_url))\n
new_delivery = context.Instance_createSalePackingList(state_change, portal.restrictedTraverse(update_service_relative_url)
, software_release_document
)\n
else:\n
new_delivery = delivery.Base_createCloneDocument(batch_mode=1)\n
new_delivery.edit(start_date=DateTime(), stop_date=DateTime(), causality_value=None)\n
new_delivery.contentValues(portal_type="Sale Packing List Line")[0].edit(resource=update_service_relative_url)\n
delivery_line = new_delivery.contentValues(portal_type="Sale Packing List Line")[0]\n
aggregate_list = delivery_line.getAggregateList(portal_type=[\'Slave Instance\', \'Software Instance\', \'Hosting Subscription\', \'Computer Partition\'])\n
aggregate_list.append(software_release_document.getRelativeUrl())\n
delivery_line.edit(resource=update_service_relative_url, aggregate_list=aggregate_list)\n
new_delivery.confirm()\n
new_delivery.start()\n
new_delivery.stop()\n
...
...
master/bt5/vifib_slapos_accounting/WorkflowTemplateItem/portal_workflow/instance_accounting_slap_interaction_workflow/scripts/Instance_changePromiseState.xml
View file @
491e37fd
...
...
@@ -122,6 +122,9 @@ else:\n
if (packing_list is not None):\n
instance.edit(causality_value=packing_list)\n
else:\n
software_release_document = instance.Base_getSoftwareReleaseDocument(instance.getRootSoftwareReleaseUrl())\n
if software_release_document is None:\n
raise NotImplemnetedError(\'Software Release %r not ready yet\' % instance.getRootSoftwareReleaseUrl())\n
# Create a new packing list from scratch\n
if (state == started):\n
service_relative_url = hosting_service_relative_url\n
...
...
@@ -130,7 +133,7 @@ else:\n
service_relative_url = cleanup_service_relative_url\n
service = cleanup_service\n
\n
packing_list = context.Instance_createSalePackingList(state_change, service)\n
packing_list = context.Instance_createSalePackingList(state_change, service
, software_release_document
)\n
instance.edit(causality_value=packing_list)\n
\n
if (state == started):\n
...
...
@@ -146,9 +149,15 @@ else:\n
service_relative_url = line.getResource()\n
\n
def letsclone(service_relative_url):\n
software_release_document = instance.Base_getSoftwareReleaseDocument(instance.getRootSoftwareReleaseUrl())\n
if software_release_document is None:\n
raise NotImplementedError(\'Software Release %r not ready yet\' % instance.getRootSoftwareReleaseUrl())\n
new_delivery = delivery.Base_createCloneDocument(batch_mode=1)\n
new_delivery.edit(start_date=DateTime(), stop_date=DateTime(), causality_value=None)\n
new_delivery.contentValues(portal_type="Sale Packing List Line")[0].edit(resource=service_relative_url)\n
delivery_line = new_delivery.contentValues(portal_type="Sale Packing List Line")[0]\n
aggregate_list = delivery_line.getAggregateList(portal_type=[\'Slave Instance\', \'Software Instance\', \'Hosting Subscription\', \'Computer Partition\'])\n
aggregate_list.append(software_release_document.getRelativeUrl())\n
delivery_line.edit(resource=service_relative_url, aggregate_list=aggregate_list)\n
return new_delivery\n
\n
new_delivery = None\n
...
...
master/bt5/vifib_slapos_accounting/WorkflowTemplateItem/portal_workflow/instance_accounting_slap_interaction_workflow/scripts/Instance_createSalePackingList.xml
View file @
491e37fd
...
...
@@ -70,12 +70,14 @@ packing_list = packing_list_module.newContent(\n
price_currency=delivery.getPriceCurrency(),\n
start_date=DateTime())\n
\n
aggregate_list = sale_order_line.getAggregateList(portal_type=[\'Slave Instance\', \'Software Instance\', \'Hosting Subscription\', \'Computer Partition\'])\n
aggregate_list.append(software_release_document.getRelativeUrl())\n
packing_list_line = packing_list.newContent(\n
portal_type=\'Sale Packing List Line\',\n
resource=service.getRelativeUrl(),\n
quantity_unit="unit/piece",\n
quantity=1,\n
aggregate_list=
sale_order_line.getAggregateList()
,\n
aggregate_list=
aggregate_list
,\n
# XXX Hardcode price on service\n
price=service.getSaleSupplyLineBasePrice(),\n
)\n
...
...
@@ -86,7 +88,7 @@ return packing_list\n
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
state_change, service
</string>
</value>
<value>
<string>
state_change, service
, software_release_document
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
...
...
master/bt5/vifib_slapos_accounting/bt/revision
View file @
491e37fd
28
\ No newline at end of file
29
\ 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