Commit c4ad2dde authored by Romain Courteaud's avatar Romain Courteaud

slapos_upgrader: migrate more properties on compute node

parent 60bf51f6
......@@ -7,10 +7,23 @@ portal = context.getPortalObject()
compute_node = context
project = portal.restrictedTraverse(project_relative_url)
edit_kw = {}
# Check if it has been migrated first
if compute_node.getFollowUpValue() is not None:
return
if compute_node.getFollowUpValue() is None:
edit_kw['follow_up_value'] = project
if compute_node.getAllocationScope('').startswith('open/'):
edit_kw['allocation_scope'] = 'open'
# Migrate
# Compute Node only need a link on itself.
compute_node.edit(follow_up_value=project)
if edit_kw:
compute_node.edit(**edit_kw)
# Drop outdated categories
category_list = compute_node.getCategoryList()
new_category_list = [x for x in category_list if not x.startswith('source_administration')]
if len(category_list) != len(new_category_list):
compute_node.setCategoryList(new_category_list)
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