Browse Source

fix checkip command

Élie Bouttier 7 years ago
parent
commit
3adb17afd9
1 changed files with 5 additions and 1 deletions
  1. 5 1
      services/management/commands/checkip.py

+ 5 - 1
services/management/commands/checkip.py

@@ -53,7 +53,11 @@ class Command(BaseCommand):
                     alloc = resource.allocations.get(active=True)
                     self.stdout.write(self.style.WARNING("L’IP %s est marqué disponible dans ip_ttnn.txt mais allouée au service #%d sur Djadhere" % (resource, alloc.service.pk)))
                 continue
-            route = Route.objects.get(name=route)
+            try:
+                route = Route.objects.get(name=route)
+            except Route.DoesNotExist:
+                self.stdout.write(self.style.WARNING("L’IP %s est routée sur %s dans ip_ttnn.txt mais cette route est inconnue dans Djadhere" % (resource, route)))
+                continue
             if resource.in_use:
                 alloc = resource.allocations.get(active=True)
                 if alloc.route != route: