Commit ac091765 authored by Alain Takoudjou's avatar Alain Takoudjou

Move not related scipts and tests from slapos_cloud to slapos_pdm

parent 429a7ab9
<?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>hosting_subscription = context\n
portal = context.getPortalObject()\n
\n
software_instance = hosting_subscription.getPredecessorValue()\n
if not software_instance:\n
return None\n
software_release_list = context.SoftwareProduct_getSortedSoftwareReleaseList(\n
software_release_url=software_instance.getUrlString())\n
\n
if not software_release_list:\n
return None\n
latest_software_release = software_release_list[0]\n
if latest_software_release.getUrlString() == software_instance.getUrlString():\n
return None\n
else:\n
return latest_software_release\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>HostingSubscription_getNewerSofwareRelease</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>"""\n
Check if this hosting subscription is upgradable to the latest version,\n
and return the software release to upgrade with.\n
"""\n
\n
hosting_subscription = context\n
portal = context.getPortalObject()\n
\n
slap_state = [\'start_requested\', \'stop_requested\']\n
\n
if not hosting_subscription.getSlapState() in slap_state:\n
return None\n
\n
source_instance = hosting_subscription.getPredecessorValue()\n
if not source_instance or source_instance.getSlapState() not in slap_state:\n
return None\n
\n
software_release = hosting_subscription.HostingSubscription_getNewerSofwareRelease()\n
if not software_release:\n
return None\n
\n
computer = source_instance.getAggregateValue().getParentValue()\n
if computer.getValidationState() != \'validated\':\n
return None\n
\n
#Find Software Installation\n
software_installation_list = portal.portal_catalog(\n
portal_type="Software Installation",\n
validation_state="validated",\n
url_string=software_release.getUrlString(),\n
default_aggregate_uid=computer.getUid(),\n
#XXX - don\'t select destroyed Software Installation\n
slap_state=\'start_requested\'\n
)\n
# check again slap_state because it might be ignored in previous request!\n
if \'start_requested\' in [software_installation.getSlapState() \\\n
for software_installation in software_installation_list]:\n
return software_release\n
\n
return None\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>HostingSubscription_getUpgradableSoftwareRelease</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 encoding="cdata"><![CDATA[
from DateTime import DateTime\n
\n
portal = context.getPortalObject()\n
\n
if software_product_reference is None:\n
assert(software_release_url is not None)\n
software_release = portal.portal_catalog.getResultValue(\n
portal_type=\'Software Release\',\n
url_string=software_release_url\n
)\n
if not software_release:\n
return []\n
software_product_reference = software_release.getAggregateReference()\n
if not software_product_reference:\n
return []\n
\n
else:\n
# Don\'t accept both parameters\n
assert(software_release_url is None)\n
\n
product_list = portal.portal_catalog(\n
portal_type=\'Software Product\',\n
reference=software_product_reference,\n
validation_state=\'published\')\n
\n
if not product_list:\n
return []\n
if len(product_list) > 1:\n
raise NotImplementedError(\'Several Software Product with the same title.\')\n
\n
software_release_list = product_list[0].getAggregateRelatedValueList()\n
\n
def sortkey(software_release):\n
publication_date = software_release.getEffectiveDate()\n
if publication_date:\n
if (publication_date - DateTime()) > 0:\n
return DateTime(\'1900/05/02\')\n
return publication_date\n
return software_release.getCreationDate()\n
\n
software_release_list = sorted(\n
software_release_list,\n
key=sortkey, reverse=True,\n
)\n
\n
return [software_release for software_release in software_release_list\n
if software_release.getValidationState() in\n
["published"]\n
]\n
]]></string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>software_product_reference=None, software_release_url=None</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SoftwareProduct_getSortedSoftwareReleaseList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
29 30
\ 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