Commit a077c9c3 authored by Rafael Monnerat's avatar Rafael Monnerat

Drop "mass upgrade" in favor of fully automation

parent 4dcaa481
<?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 = context.getAggregateRelatedValue()\n
\n
if instance is not None:\n
host_sub = instance.getSpecialiseValue()\n
person = host_sub.getDestinationSectionValue(portal_type="Person")\n
\n
status = host_sub.getSlapState()\n
\n
if status == "start_requested":\n
state = "started"\n
elif status == "stop_requested":\n
state = "stopped"\n
elif status == "destroy_requested":\n
state = "destroyed"\n
\n
person.requestSoftwareInstance(\n
state=state,\n
software_release=new_sr_url,\n
software_title=host_sub.getTitle(),\n
software_type=host_sub.getSourceReference(),\n
instance_xml=host_sub.getTextContent(),\n
sla_xml=host_sub.getSlaXml(),\n
shared=host_sub.isRootSlave()\n
)\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>new_sr_url, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ComputerPartition_changeHostingSubscriptionSoftwareRelease</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>return [x for x in context.Base_getRelatedObjectList(portal_type=\'Software Release\') if context.portal_catalog(portal_type=\'Software Installation\', slap_state=\'start_requested\', url_string=x.getUrlString(), limit=1)]\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>**kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SoftwareProduct_getInstalledSoftwareReleaseList</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>from Products.ERP5Type.Message import translateString\n
\n
if listbox is None:\n
listbox = []\n
\n
portal = context.getPortalObject()\n
message_list = []\n
\n
for parameters in listbox:\n
new_sr_path = parameters[\'workflow_action\']\n
\n
if new_sr_path is not None and new_sr_path != \'\':\n
new_sr_document = portal.restrictedTraverse(new_sr_path)\n
new_sr_url = new_sr_document.getUrlString()\n
old_sr_document = portal.restrictedTraverse(parameters[\'listbox_key\'])\n
\n
comp_reference_list = parameters[\'computer_filter\']\n
if comp_reference_list != []:\n
for comp_reference in comp_reference_list:\n
comp = portal.portal_catalog.getResultValue(portal_type = \'Computer\', reference = comp_reference)\n
if new_sr_url not in portal.portal_catalog.getResultValue(portal_type=\'Software Installation\', default_aggregate_related_value=comp.getRelativeUrl()):\n
message_list.append("Software Release %s not installed on %s." % (new_sr_document.getTitle(), comp_reference))\n
else:\n
message_list.append("No computers selected for upgrade from %s to %s" % (old_sr_document.getUrlString(), new_sr_url))\n
\n
tag = \'software_release_change_from_%s_to_%s\' % (old_sr_document.getReference(), new_sr_document.getReference())\n
\n
old_sr_document.activate(tag=tag).SoftwareRelease_requestInstanceUpgrade(new_sr_url, comp_reference_list, tag)\n
\n
# activate something on the module after everything, so that user can know that something is happening in the background\n
context.activate(after_tag=tag).getTitle()\n
\n
# reset selection checked uids\n
context.portal_selections.setSelectionCheckedUidsFor(selection_name, [])\n
\n
portal_status_message = "Upgrade of instances in progress.\\r\\n"\n
\n
if message_list != []:\n
portal_status_message += "\\r\\n".join(message_list)\n
\n
return context.Base_redirect(form_id,\n
keep_items=dict(portal_status_message=translateString(portal_status_message)))\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>listbox=None, selection_name=\'\', form_id=\'view\', **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SoftwareProduct_launchMassUpgrade</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ERP5Form" module="Products.ERP5Form.Form"/>
</pickle>
<pickle>
<dictionary>
<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/>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>action</string> </key>
<value> <string>SoftwareProduct_launchMassUpgrade</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>edit_order</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>enctype</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>group_list</string> </key>
<value>
<list>
<string>bottom</string>
<string>hidden</string>
</list>
</value>
</item>
<item>
<key> <string>groups</string> </key>
<value>
<dictionary>
<item>
<key> <string>bottom</string> </key>
<value>
<list>
<string>listbox</string>
</list>
</value>
</item>
<item>
<key> <string>hidden</string> </key>
<value>
<list>
<string>listbox_workflow_action</string>
<string>your_comment</string>
<string>listbox_usage</string>
<string>listbox_computer_filter</string>
</list>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SoftwareProduct_viewMassUpgradeDialog</string> </value>
</item>
<item>
<key> <string>method</string> </key>
<value> <string>POST</string> </value>
</item>
<item>
<key> <string>name</string> </key>
<value> <string>SoftwareProduct_viewMassUpgradeDialog</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
<value> <string>form_dialog</string> </value>
</item>
<item>
<key> <string>row_length</string> </key>
<value> <int>4</int> </value>
</item>
<item>
<key> <string>stored_encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Mass upgrade</string> </value>
</item>
<item>
<key> <string>unicode_mode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>update_action</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>update_action_title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>columns</string>
<string>editable_columns</string>
<string>list_method</string>
<string>portal_types</string>
<string>selection_name</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>listbox</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>columns</string> </key>
<value>
<list>
<tuple>
<string>title</string>
<string>Software Release</string>
</tuple>
<tuple>
<string>computer_filter</string>
<string>Select COMPs</string>
</tuple>
<tuple>
<string>workflow_action</string>
<string>Upgrade To</string>
</tuple>
</list>
</value>
</item>
<item>
<key> <string>editable_columns</string> </key>
<value>
<list>
<tuple>
<string>computer_filter</string>
<string>Select COMPs</string>
</tuple>
<tuple>
<string>workflow_action</string>
<string>Upgrade To</string>
</tuple>
</list>
</value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_view_mode_listbox</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>list_method</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>portal_types</string> </key>
<value>
<list>
<tuple>
<string>Software Release</string>
<string>Software Release</string>
</tuple>
</list>
</value>
</item>
<item>
<key> <string>selection_name</string> </key>
<value> <string>mass_upgrade_selection</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Software Releases</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Method" module="Products.Formulator.MethodField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>method_name</string> </key>
<value> <string>SoftwareProduct_getInstalledSoftwareReleaseList</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>if new_sr_url is None or new_sr_url == \'\' or comp_reference_list == [] or comp_reference_list is None:\n
raise ValueError()\n
\n
old_sr_url = context.getUrlString()\n
portal = context.getPortalObject()\n
\n
portal.portal_catalog.searchAndActivate( \n
portal_type = \'Computer Partition\',\n
parent_reference = comp_reference_list,\n
free_for_request = 0,\n
software_release_url = old_sr_url,\n
method_id = \'ComputerPartition_changeHostingSubscriptionSoftwareRelease\',\n
method_kw = {\'new_sr_url\': new_sr_url},\n
activate_kw = {\'tag\': tag}\n
)\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>new_sr_url, comp_reference_list, tag, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SoftwareRelease_requestInstanceUpgrade</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
12
\ No newline at end of file
13
\ No newline at end of file
testSlapOSCloudMassUpgrade
\ No newline at end of file
testSlapOSPDMSkins
testSlapOSPDMAlarm
\ 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