Commit be1d90ed authored by Romain Courteaud's avatar Romain Courteaud

slapos_upgrader: move to personal if no instance allocated

parent 594335b7
...@@ -21,11 +21,14 @@ not_migrated_instance_tree_dict[instance_tree_relative_url] = { ...@@ -21,11 +21,14 @@ not_migrated_instance_tree_dict[instance_tree_relative_url] = {
'slap_state': instance_tree.getSlapState(), 'slap_state': instance_tree.getSlapState(),
'destination_section': instance_tree.getDestinationSection(None), 'destination_section': instance_tree.getDestinationSection(None),
'project_relative_url': project_relative_url, 'project_relative_url': project_relative_url,
'alive_instance_list': [] 'alive_instance_list': [],
'allocated_instance_list': []
} }
for sql_instance in portal.portal_catalog(specialise__uid=instance_tree.getUid()): for sql_instance in portal.portal_catalog(specialise__uid=instance_tree.getUid()):
if not ((sql_instance.getAggregate(None) is None) and (sql_instance.getValidationState() == 'invalidated')): if not ((sql_instance.getAggregate(None) is None) and (sql_instance.getValidationState() == 'invalidated')):
not_migrated_instance_tree_dict[instance_tree_relative_url]['alive_instance_list'].append(sql_instance.getRelativeUrl()) not_migrated_instance_tree_dict[instance_tree_relative_url]['alive_instance_list'].append(sql_instance.getRelativeUrl())
if sql_instance.getAggregate(None) is not None:
not_migrated_instance_tree_dict[instance_tree_relative_url]['allocated_instance_list'].append(sql_instance.getRelativeUrl())
# Node linked to a project # Node linked to a project
if not_migrated_instance_tree_dict[instance_tree_relative_url]['project_relative_url'] is not None: if not_migrated_instance_tree_dict[instance_tree_relative_url]['project_relative_url'] is not None:
...@@ -80,3 +83,10 @@ elif (software_instance is not None) and (software_instance.getAggregateValue(No ...@@ -80,3 +83,10 @@ elif (software_instance is not None) and (software_instance.getAggregateValue(No
if project is not None: if project is not None:
instance_tree.activate().Base_activateObjectMigrationToVirtualMaster(project.getRelativeUrl()) instance_tree.activate().Base_activateObjectMigrationToVirtualMaster(project.getRelativeUrl())
not_migrated_instance_tree_dict.pop(instance_tree_relative_url) not_migrated_instance_tree_dict.pop(instance_tree_relative_url)
# If no instance is allocated, it will probably never be. Move to personal
elif ((len(not_migrated_instance_tree_dict[instance_tree_relative_url]['allocated_instance_list']) == 0) and
(not_migrated_instance_tree_dict[instance_tree_relative_url]['destination_section'] is not None)):
instance_tree.getDestinationSectionValue().Person_checkSiteMigrationCreatePersonalVirtualMaster([instance_tree_relative_url])
not_migrated_instance_tree_dict.pop(instance_tree_relative_url)
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