mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-25 04:43:10 +00:00
Fix for an unstable database state
It happened that one of the switch port had a related interface while the related interface did not have the port.related_port attribute (which should not happened but happened) so the code was not able to fix it. Now it can be fixed. I did not managed to get it work if you want to remove the existing relation (setting related to None) but now, at least you can re-add the existing relation (add correct related where it is missing) and find back a stable state and restart normally from here.
This commit is contained in:
parent
0f35bfe7e0
commit
8226bd405c
1 changed files with 3 additions and 2 deletions
|
@ -371,8 +371,9 @@ class Port(AclMixin, RevMixin, models.Model):
|
||||||
mutuellement exclusifs")
|
mutuellement exclusifs")
|
||||||
if self.related == self:
|
if self.related == self:
|
||||||
raise ValidationError("On ne peut relier un port à lui même")
|
raise ValidationError("On ne peut relier un port à lui même")
|
||||||
if self.related and not self.related.related:
|
if self.related:
|
||||||
if self.related.machine_interface or self.related.room:
|
if self.related.machine_interface or self.related.room or\
|
||||||
|
(self.related.related and self.related.related != self):
|
||||||
raise ValidationError("Le port relié est déjà occupé, veuillez\
|
raise ValidationError("Le port relié est déjà occupé, veuillez\
|
||||||
le libérer avant de créer une relation")
|
le libérer avant de créer une relation")
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue