Commit 31e21a61 authored by Romain Courteaud's avatar Romain Courteaud

slapos_upgrader: do not return too early

parent 3a1e44a4
......@@ -28,6 +28,8 @@ if root_software_instance is not None:
root_instance_virtual_master_relative_url = root_partition.getParentValue().getFollowUp(None)
if ((root_instance_virtual_master_relative_url is not None) and
(root_instance_virtual_master_relative_url != instance_tree_virtual_master_relative_url)):
instance_tree_migration_needed = True
# ensure no software instance is not on the instance tree
# virtual master. If so, keep the instance tree virtual master
for sql_result in portal.portal_catalog(
......@@ -39,20 +41,21 @@ if root_software_instance is not None:
if instance_partition is not None:
instance_virtual_master_relative_url = instance_partition.getParentValue().getFollowUp(None)
if (instance_virtual_master_relative_url == instance_tree_virtual_master_relative_url):
return
instance_tree_migration_needed = False
edit_kw ={'follow_up_value': None}
activate_kw = {'tag': tag}
instance_tree.edit(**edit_kw)
instance_tree.reindexObject(activate_kw=activate_kw)
for sql_result in portal.portal_catalog(
specialise__uid=instance_tree.getUid(),
portal_type=['Software Instance', 'Slave Instance']
):
instance = sql_result.getObject()
instance.edit(**edit_kw)
instance.reindexObject(activate_kw=activate_kw)
return
if instance_tree_migration_needed:
edit_kw ={'follow_up_value': None}
activate_kw = {'tag': tag}
instance_tree.edit(**edit_kw)
instance_tree.reindexObject(activate_kw=activate_kw)
for sql_result in portal.portal_catalog(
specialise__uid=instance_tree.getUid(),
portal_type=['Software Instance', 'Slave Instance']
):
instance = sql_result.getObject()
instance.edit(**edit_kw)
instance.reindexObject(activate_kw=activate_kw)
return
#######################################################################
# If instance is not allocated on the same virtual master than instance tree
......
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