Commit cf5bc4a6 authored by Romain Courteaud's avatar Romain Courteaud

slapos_cloud:

* drip upgrade_scope
* no need to search a Software Product if there is no url_string
* only search compute node from the same project
parent ce588164
......@@ -4,32 +4,34 @@ software_product = None
software_release = None
software_type = None
use_category_uid = portal.restrictedTraverse("portal_categories/use/trade/sale").getUid(),
product_list = portal.portal_catalog(
portal_type="Software Product",
validation_state=['validated', 'published'],
use__uid=use_category_uid,
follow_up__uid=context.getFollowUpUid()
)
if url_string:
if len(product_list) != 0:
software_release = portal.portal_catalog.getResultValue(
portal_type="Software Product Release Variation",
url_string=url_string,
parent_uid=[x.getUid() for x in product_list]
use_category_uid = portal.restrictedTraverse("portal_categories/use/trade/sale").getUid(),
product_list = portal.portal_catalog(
portal_type="Software Product",
validation_state=['validated', 'published'],
use__uid=use_category_uid,
follow_up__uid=context.getFollowUpUid()
)
if software_release is not None:
software_product = software_release.getParentValue()
software_type = portal.portal_catalog.getResultValue(
parent_uid=software_product.getUid(),
title=context.getSourceReference(),
portal_type="Software Product Type Variation"
if len(product_list) != 0:
software_release = portal.portal_catalog.getResultValue(
portal_type="Software Product Release Variation",
url_string=url_string,
parent_uid=[x.getUid() for x in product_list]
)
if software_type is None:
software_release = None
software_product = None
if software_release is not None:
software_product = software_release.getParentValue()
software_type = portal.portal_catalog.getResultValue(
parent_uid=software_product.getUid(),
title=context.getSourceReference(),
portal_type="Software Product Type Variation"
)
if software_type is None:
software_release = None
software_product = None
return software_product, software_release, software_type
......@@ -2,7 +2,6 @@ compute_node = state_change['object']
portal = compute_node.getPortalObject()
compute_node.edit(
allocation_scope='open',
upgrade_scope='auto',
capacity_scope='open'
)
......
......@@ -29,7 +29,12 @@ if len(project_list) != 1:
raise NotImplementedError("%i projects '%s'" % (len(project_list), project_reference))
compute_node_portal_type = "Compute Node"
compute_node_list = portal.portal_catalog.portal_catalog(portal_type=compute_node_portal_type, title=compute_node_title, limit=2)
compute_node_list = portal.portal_catalog.portal_catalog(
portal_type=compute_node_portal_type,
title=compute_node_title,
follow_up__uid=project_list[0].getUid(),
limit=2
)
if len(compute_node_list) == 2:
raise NotImplementedError
......
......@@ -67,7 +67,6 @@ else:
reference=instance_tree_reference,
title=software_title,
destination_section=person.getRelativeUrl(),
upgrade_scope="auto",
follow_up_value=project_list[0],
activate_kw={'tag': tag},
)
......
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