Commit a038b7e2 authored by Gabriel Monnerat's avatar Gabriel Monnerat

remove useless scripts and add Slave Instance in portal type list

parent 11d4a023
<?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_partition = state_change[\'object\']\n
computer_partition_capacity = computer_partition.getQuantity()\n
computer_partition_usage = 0\n
for slave_partition in computer_partition.contentValues(portal_type=\'Slave Partition\'):\n
if slave_partition.getSlapState() == \'busy\':\n
computer_partition_usage += 1\n
if computer_partition_usage > computer_partition_capacity:\n
raise ValueError(\'Computer Partition quantity is lower then amount of busy Slave Partitions\')\n
available_capacity = computer_partition_capacity - computer_partition_usage\n
for slave_partition in computer_partition.contentValues(portal_type=\'Slave Partition\'):\n
if slave_partition.getSlapState() == \'free\':\n
# Deactivate free slave partition if needed\n
if available_capacity > 0:\n
available_capacity -= 1\n
else:\n
slave_partition.markInactive()\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>ComputerPartition_checkBusySlavePartitionList</string> </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>computer_partition = state_change[\'object\']\n
\n
isTransitionPossible = computer_partition.getPortalObject().portal_workflow.isTransitionPossible\n
for slave_partition in computer_partition.contentValues(portal_type="Slave Partition"):\n
if slave_partition.getSlapState() == \'busy\':\n
# XXX Busy slave partition has to be free by delivering related Sale Packing List\n
raise NotImplementedError("Free Slave Partition")\n
if isTransitionPossible(slave_partition, \'mark_inactive\'):\n
slave_partition.markInactive()\n
\n
\n
computer_partition.edit(quantity=None)\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>ComputerPartition_freeSlavePartition</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -58,7 +58,7 @@ assert len(sale_packing_list_line_list) == 1\n ...@@ -58,7 +58,7 @@ assert len(sale_packing_list_line_list) == 1\n
sale_packing_list_line = sale_packing_list_line_list[0]\n sale_packing_list_line = sale_packing_list_line_list[0]\n
resource = sale_packing_list_line.getResource()\n resource = sale_packing_list_line.getResource()\n
if resource == preference_tool.getPreferredInstanceSetupResource():\n if resource == preference_tool.getPreferredInstanceSetupResource():\n
software_instance = sale_packing_list_line.getAggregateValue(portal_type=\'Software Instance\')\n software_instance = sale_packing_list_line.getAggregateValue(portal_type=[\'Software Instance\', \'Slave Instance\'])\n
if software_instance.getSlapState() == \'start_requested\':\n if software_instance.getSlapState() == \'start_requested\':\n
software_instance.requestStartComputerPartition()\n software_instance.requestStartComputerPartition()\n
elif software_instance.getSlapState() == \'stop_requested\':\n elif software_instance.getSlapState() == \'stop_requested\':\n
......
<?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>slave_partition = state_change[\'object\']\n
slave_partition.getParentValue().reindexObject()\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>SlavePartition_reindexComputerPartition</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
392 393
\ No newline at end of file \ 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