Commit a130c58f authored by Romain Courteaud's avatar Romain Courteaud

slapos_cloud: allocation scope is meaningless to restrict allocation permission

parent 2025ad61
if context.getPortalObject().portal_workflow.isTransitionPossible(context, 'mark_busy') and context.getParentValue().isMemberOf('allocation_scope/open'): if context.getPortalObject().portal_workflow.isTransitionPossible(context, 'mark_busy'):
return 1 return 1
return 0 return 0
import random import random
from Products.ZSQLCatalog.SQLCatalog import SimpleQuery, ComplexQuery from Products.ZSQLCatalog.SQLCatalog import SimpleQuery, ComplexQuery
person = context person = context
portal = context.getPortalObject()
def getOpenAllocationScopeUidList(exclude_uid_list):
return [scope.getUid() for scope in portal.portal_categories.allocation_scope.open.objectValues()
if scope.getUid() not in exclude_uid_list]
compute_partition = None compute_partition = None
...@@ -88,21 +83,6 @@ for base_category in compute_node_base_category_list: ...@@ -88,21 +83,6 @@ for base_category in compute_node_base_category_list:
else: else:
query_kw["%s_uid" % base_category] = category.getUid() query_kw["%s_uid" % base_category] = category.getUid()
query_kw["capacity_scope_uid"] = portal.portal_categories.capacity_scope.open.getUid()
if subscription_reference is not None and software_instance_portal_type != "Slave Instance":
# Subscriptions uses a specific set of allocation scope
query_kw["allocation_scope_uid"] = portal.portal_categories.allocation_scope.open.subscription.getUid()
elif subscription_reference is not None and \
software_instance_portal_type == "Slave Instance" and \
is_root_slave:
# Subscriptions uses a specific set of allocation scope
query_kw["allocation_scope_uid"] = getOpenAllocationScopeUidList([])
else:
# else pic anything but open/subscription
query_kw["allocation_scope_uid"] = getOpenAllocationScopeUidList(
exclude_uid_list=[portal.portal_categories.allocation_scope.open.subscription.getUid()])
extra_query_kw = context.ComputePartition_getCustomAllocationParameterDict( extra_query_kw = context.ComputePartition_getCustomAllocationParameterDict(
software_release_url, software_type, software_instance_portal_type, software_release_url, software_type, software_instance_portal_type,
filter_kw_copy, computer_network_query, test_mode) filter_kw_copy, computer_network_query, test_mode)
......
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