Commit ff6abc7c authored by Romain Courteaud's avatar Romain Courteaud

slapos_cloud: allocation scope is meaningless to restrict allocation permission

parent 4f9b3b23
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 0
import random
from Products.ZSQLCatalog.SQLCatalog import SimpleQuery, ComplexQuery
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
......@@ -88,21 +83,6 @@ for base_category in compute_node_base_category_list:
else:
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(
software_release_url, software_type, software_instance_portal_type,
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