Commit a17a061f authored by Romain Courteaud's avatar Romain Courteaud

slapos_cloud: also search allocation supply by node

parent 43c23b85
line = context.getParentValue() line = context.getParentValue()
supply = line.getParentValue() supply = line.getParentValue()
if (supply.getPortalType() != 'Allocation Supply') or (supply.getValidationState() != 'validated'): if (supply.getPortalType() != 'Allocation Supply') or (supply.getValidationState() != 'validated') or (supply.getAggregate(None) is None):
return None return None
if not context.isAllocable(): if not context.isAllocable():
return None return None
base_category_tuple = ('resource', 'software_type', 'software_release', 'destination_project') base_category_tuple = ('resource', 'software_type', 'software_release', 'destination_project', 'aggregate')
if supply.getDestination(): if supply.getDestination():
base_category_tuple += ('destination',) base_category_tuple += ('destination',)
return context.generatePredicate(membership_criterion_base_category_list = base_category_tuple, return context.generatePredicate(membership_criterion_base_category_list = base_category_tuple,
criterion_property_list = ('start_date',)) criterion_property_list = ('start_date',))
...@@ -16,7 +16,10 @@ if software_product is not None: ...@@ -16,7 +16,10 @@ if software_product is not None:
if destination_value is None: if destination_value is None:
destination_value = portal.portal_membership.getAuthenticatedMember().getUserValue() destination_value = portal.portal_membership.getAuthenticatedMember().getUserValue()
if len(tested_base_category_list) == 5: if node_value is not None:
tested_base_category_list.append('aggregate')
if len(tested_base_category_list) == 6:
tested_base_category_list = None tested_base_category_list = None
if predicate_portal_type is None: if predicate_portal_type is None:
...@@ -30,6 +33,7 @@ tmp_context = portal.portal_trash.newContent( ...@@ -30,6 +33,7 @@ tmp_context = portal.portal_trash.newContent(
software_release_value=software_product_release, software_release_value=software_product_release,
destination_value=destination_value, destination_value=destination_value,
destination_project_value=project, destination_project_value=project,
aggregate_value=node_value,
start_date=DateTime() start_date=DateTime()
) )
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>software_product=None, software_product_type=None, software_product_release=None, destination_value=None, predicate_portal_type=None</string> </value> <value> <string>software_product=None, software_product_type=None, software_product_release=None, destination_value=None, node_value=None, predicate_portal_type=None</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
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