Commit f5ef50e8 authored by Romain Courteaud's avatar Romain Courteaud

slapos_upgrader: instances do not always have a predecessor

parent 74bc8891
...@@ -60,9 +60,9 @@ else: ...@@ -60,9 +60,9 @@ else:
# invert the instance references, to ensure cdn keep the same domain name # invert the instance references, to ensure cdn keep the same domain name
# as we also want to keep subobject (login), change the instance from one tree into another # as we also want to keep subobject (login), change the instance from one tree into another
original_predecessor = instance.getSuccessorRelatedValue() original_predecessor = instance.getSuccessorRelatedValue()
assert original_predecessor is not None if original_predecessor is not None:
successor_list = original_predecessor.getSuccessorList() successor_list = original_predecessor.getSuccessorList()
successor_list = [x.replace(instance.getRelativeUrl(), requested_software_instance.getRelativeUrl()) for x in successor_list] successor_list = [x.replace(instance.getRelativeUrl(), requested_software_instance.getRelativeUrl()) for x in successor_list]
instance_title = instance.getTitle() instance_title = instance.getTitle()
instance_tree = instance.getSpecialiseValue() instance_tree = instance.getSpecialiseValue()
...@@ -79,9 +79,10 @@ else: ...@@ -79,9 +79,10 @@ else:
aggregate_value=remote_partition, aggregate_value=remote_partition,
follow_up_value=remote_instance_tree.getFollowUpValue() follow_up_value=remote_instance_tree.getFollowUpValue()
) )
original_predecessor.edit( if original_predecessor is not None:
successor_list=successor_list original_predecessor.edit(
) successor_list=successor_list
)
requested_software_instance.edit( requested_software_instance.edit(
title=instance_title, title=instance_title,
specialise_value=instance_tree, specialise_value=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