Commit f343a799 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_cloud: Subscription computers updates capacity like open computers

parent ca850fa6
portal = context.getPortalObject() portal = context.getPortalObject()
category = portal.restrictedTraverse("portal_categories/allocation_scope/open/public", None) category_list = [portal.restrictedTraverse("portal_categories/allocation_scope/open/public", None),
if category is not None: portal.restrictedTraverse("portal_categories/allocation_scope/open/subscription", None)]
category_uid_list = [ i.getUid() for i in category_list if i is not None]
if category_uid_list:
portal.portal_catalog.searchAndActivate( portal.portal_catalog.searchAndActivate(
portal_type='Computer', portal_type='Computer',
default_allocation_scope_uid=category.getUid(), default_allocation_scope_uid=category_uid_list,
validation_state="validated", validation_state="validated",
method_id='Computer_checkAndUpdateCapacityScope', method_id='Computer_checkAndUpdateCapacityScope',
activate_kw={'tag': tag} activate_kw={'tag': tag}
......
...@@ -2,7 +2,7 @@ import json ...@@ -2,7 +2,7 @@ import json
computer = context computer = context
portal = context.getPortalObject() portal = context.getPortalObject()
if computer.getAllocationScope() != 'open/public': if computer.getAllocationScope() not in ['open/public', 'open/subscription']:
# Don't update non public computer # Don't update non public computer
return return
......
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