Commit c2c76f5b authored by Alain Takoudjou's avatar Alain Takoudjou Committed by Rafael Monnerat

Move not related scipts and tests from slapos_cloud to slapos_pdm

parent 6e0d89c3
321 322
\ No newline at end of file \ No newline at end of file
...@@ -3,5 +3,4 @@ testSlapOSCloudConstraint ...@@ -3,5 +3,4 @@ testSlapOSCloudConstraint
testSlapOSCloudSecurityGroup testSlapOSCloudSecurityGroup
testSlapOSCloudShadow testSlapOSCloudShadow
testSlapOSCloudWorkflow testSlapOSCloudWorkflow
testSlapOSCloudDocument testSlapOSCloudDocument
testSlapOSSoftwareProduct \ No newline at end of file
\ No newline at end of file
...@@ -55,17 +55,17 @@ portal = context.getPortalObject()\n ...@@ -55,17 +55,17 @@ portal = context.getPortalObject()\n
\n \n
software_instance = hosting_subscription.getPredecessorValue()\n software_instance = hosting_subscription.getPredecessorValue()\n
if not software_instance:\n if not software_instance:\n
return ""\n return None\n
software_release_list = context.SoftwareProduct_getSortedSoftwareReleaseList(\n software_release_list = context.SoftwareProduct_getSortedSoftwareReleaseList(\n
software_release_url=software_instance.getUrlString())\n software_release_url=software_instance.getUrlString())\n
\n \n
if not software_release_list:\n if not software_release_list:\n
return ""\n return None\n
latest_software_release = software_release_list[0]\n latest_software_release = software_release_list[0]\n
if software_release_list[0].getUrlString() == software_instance.getUrlString():\n if latest_software_release.getUrlString() == software_instance.getUrlString():\n
return ""\n return None\n
else:\n else:\n
return latest_software_release.getUrlString()\n return latest_software_release\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
......
...@@ -50,42 +50,46 @@ ...@@ -50,42 +50,46 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>hosting_subscription = context\n <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 portal = context.getPortalObject()\n
\n \n
slap_state = [\'start_requested\', \'stop_requested\']\n slap_state = [\'start_requested\', \'stop_requested\']\n
\n \n
if not hosting_subscription.getSlapState() in slap_state:\n if not hosting_subscription.getSlapState() in slap_state:\n
return False\n return None\n
\n \n
source_instance = hosting_subscription.getPredecessorValue()\n source_instance = hosting_subscription.getPredecessorValue()\n
if not source_instance or source_instance.getSlapState() not in slap_state:\n if not source_instance or source_instance.getSlapState() not in slap_state:\n
return False\n return None\n
\n \n
latest_software_url = hosting_subscription.HostingSubscription_getNewerSofwareRelease()\n software_release = hosting_subscription.HostingSubscription_getNewerSofwareRelease()\n
if latest_software_url == "":\n if not software_release:\n
return False\n return None\n
\n \n
computer = source_instance.getAggregateValue().getParentValue()\n computer = source_instance.getAggregateValue().getParentValue()\n
if computer.getValidationState() != \'validated\':\n if computer.getValidationState() != \'validated\':\n
return False\n return None\n
isUpgradable = True\n
\n \n
#Find Software Installation\n #Find Software Installation\n
software_installation_list = portal.portal_catalog(\n software_installation_list = portal.portal_catalog(\n
portal_type="Software Installation",\n portal_type="Software Installation",\n
validation_state="validated",\n validation_state="validated",\n
url_string=latest_software_url,\n url_string=software_release.getUrlString(),\n
default_aggregate_uid=computer.getUid(),\n default_aggregate_uid=computer.getUid(),\n
#XXX - don\'t select destroyed Software Installation\n #XXX - don\'t select destroyed Software Installation\n
slap_state=\'start_requested\'\n slap_state=\'start_requested\'\n
)\n )\n
# check again slap_state because it might be ignored in previous request!\n # check again slap_state because it might be ignored in previous request!\n
if not \'start_requested\' in [software_installation.getSlapState() \\\n if \'start_requested\' in [software_installation.getSlapState() \\\n
for software_installation in software_installation_list]:\n for software_installation in software_installation_list]:\n
isUpgradable = False\n return software_release\n
\n \n
return isUpgradable\n return None\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
...@@ -94,7 +98,7 @@ return isUpgradable\n ...@@ -94,7 +98,7 @@ return isUpgradable\n
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>HostingSubscription_isUpgradable</string> </value> <value> <string>HostingSubscription_getUpgradableSoftwareRelease</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
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