Commit 6e4d08ac authored by Romain Courteaud's avatar Romain Courteaud

Always create update packing list when one parameter value changes

parent a097d81a
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="InteractionDefinition" module="Products.ERP5.Interaction"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>actbox_category</string> </key>
<value> <string>workflow</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>activate_script_name</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>after_script_name</string> </key>
<value>
<list>
<string>Instance_changePromiseParameter</string>
</list>
</value>
</item>
<item>
<key> <string>before_commit_script_name</string> </key>
<value>
<tuple/>
</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>change_instance_parameter</string> </value>
</item>
<item>
<key> <string>method_id</string> </key>
<value>
<list>
<string>_setRootSoftwareReleaseUrl</string>
<string>_setTextContent</string>
<string>_setSourceReference</string>
<string>_setSlaXml</string>
</list>
</value>
</item>
<item>
<key> <string>once_per_transaction</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>portal_type_filter</string> </key>
<value>
<list>
<string>Slave Instance</string>
<string>Software Instance</string>
</list>
</value>
</item>
<item>
<key> <string>script_name</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>temporary_document_disallowed</string> </key>
<value> <int>1</int> </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>
<?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
\n
# Get latest workflow transition\n
state = instance.getSlapState()\n
started = "start_requested"\n
stopped = "stop_requested"\n
\n
if (state in (started, stopped)):\n
partition = instance.getAggregate(portal_type="Computer Partition")\n
if (partition is not None):\n
portal = instance.getPortalObject()\n
delivery = instance.getCausalityValue(portal_type=["Sale Packing List"])\n
update_service_relative_url = portal.portal_preferences.getPreferredInstanceUpdateResource()\n
\n
new_delivery = delivery.Base_createCloneDocument(batch_mode=1)\n
new_delivery.edit(start_date=DateTime(), stop_date=DateTime())\n
new_delivery.contentValues(portal_type="Sale Packing List Line")[0].edit(resource=update_service_relative_url)\n
new_delivery.confirm()\n
new_delivery.start()\n
new_delivery.stop()\n
new_delivery.deliver()\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>Instance_changePromiseParameter</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -72,8 +72,6 @@ hosting_service_relative_url = portal.portal_preferences.getPreferredInstanceHos
hosting_service = portal.restrictedTraverse(hosting_service_relative_url)\n
cleanup_service_relative_url = portal.portal_preferences.getPreferredInstanceCleanupResource()\n
cleanup_service = portal.restrictedTraverse(cleanup_service_relative_url)\n
update_service_relative_url = portal.portal_preferences.getPreferredInstanceUpdateResource()\n
update_service = portal.restrictedTraverse(update_service_relative_url)\n
# Get software release\n
software_release_document = portal.portal_catalog.getResultValue(\n
portal_type=\'Software Release\',\n
......@@ -209,7 +207,7 @@ else:\n
if (state == started):\n
if (delivery.getSimulationState() == \'stopped\'):\n
delivery.deliver()\n
new_delivery = letsclone(update_service_relative_url)\n
new_delivery = letsclone(hosting_service_relative_url)\n
new_delivery.confirm()\n
instance.edit(causality_value=new_delivery)\n
elif (state == stopped):\n
......@@ -225,17 +223,6 @@ else:\n
elif (service_relative_url == cleanup_service_relative_url):\n
raise NotImplementedError, "Not update should be allowed"\n
\n
elif (service_relative_url == update_service_relative_url):\n
if (state == started):\n
pass\n
elif (state == stopped):\n
pass\n
elif (state == destroyed):\n
new_delivery = letsclone(cleanup_service_relative_url)\n
new_delivery.confirm()\n
instance.edit(causality_value=new_delivery)\n
else:\n
raise NotImplementedError\n
else:\n
raise NotImplementedError\n
</string> </value>
......
9
\ No newline at end of file
10
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment