Commit 60cc2a52 authored by Romain Courteaud's avatar Romain Courteaud

slapos_pdm: drop not used scripts

parent 8dd2db04
instance_tree = context
software_instance = instance_tree.getSuccessorValue()
if not software_instance:
return None
software_release_list = context.SoftwareProduct_getSortedSoftwareReleaseList(
software_release_url=software_instance.getUrlString())
if not software_release_list:
return None
latest_software_release = software_release_list[0]
if latest_software_release.getUrlString() == software_instance.getUrlString():
return None
else:
return latest_software_release
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="_reconstructor" module="copy_reg"/>
</klass>
<tuple>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
<global name="object" module="__builtin__"/>
<none/>
</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>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>InstanceTree_getNewerSofwareRelease</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
"""
Check if this instance tree is upgradable to the latest version,
and return the software release to upgrade with.
"""
instance_tree = context
portal = context.getPortalObject()
slap_state = ['start_requested', 'stop_requested']
if not instance_tree.getSlapState() in slap_state:
return None
source_instance_list = [q for q in instance_tree.getSuccessorValueList() if q.getSlapState() in slap_state]
if len(source_instance_list) == 0:
return None
source_instance = source_instance_list[0]
software_release = instance_tree.InstanceTree_getNewerSofwareRelease()
if not software_release:
return None
compute_node = source_instance.getAggregateValue().getParentValue()
if compute_node.getValidationState() != 'validated':
return None
#Find Software Installation
software_installation_list = portal.portal_catalog(
portal_type="Software Installation",
validation_state="validated",
url_string=software_release.getUrlString(),
default_aggregate_uid=compute_node.getUid(),
)
# check again slap_state because it might be ignored in previous request!
if 'start_requested' in [software_installation.getSlapState() \
for software_installation in software_installation_list]:
return software_release
return None
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="_reconstructor" module="copy_reg"/>
</klass>
<tuple>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
<global name="object" module="__builtin__"/>
<none/>
</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>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>InstanceTree_getUpgradableSoftwareRelease</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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