-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ValidationError crash on rack import #4
Comments
BTW I did try this patch: diff --git a/diffsync/models/abstract.py b/diffsync/models/abstract.py
index 36accb9..a44216d 100644
--- a/diffsync/models/abstract.py
+++ b/diffsync/models/abstract.py
@@ -13,9 +13,11 @@ from typing import Mapping, Optional, Tuple, Union
from diffsync import DiffSync, DiffSyncModel
from diffsync.exceptions import ObjectNotFound
+from django.core.exceptions import ValidationError
from django.db import models
from django.db.utils import IntegrityError
from pydantic import BaseModel, validator
import structlog
from .references import (
@@ -182,7 +184,7 @@ class NautobotBaseModel(DiffSyncModel):
for attr, value in multivalue_attrs.items():
getattr(record, attr).set(value)
return record
- except IntegrityError as exc:
+ except (IntegrityError, ValidationError) as exc:
logger.error(f"Error in creating {nautobot_model}: {exc}")
return None And it did make it further, but not totally sure that this is the correct move here. |
That's definitely a step in the right direction! Looks like I should be catching |
The specific ValidationError you reported suggests that you have a Device in your source data which is assigned directly to Site "iad1" but is also assigned to a Rack that is itself assigned to Site "ord1", which Nautobot considers to be invalid. To successfully import this device you'll have to fix your source data, but I can at least update this plugin so it will report this error and continue instead of aborting. |
Environment
Expected Behavior
Full import!
I have a rather large production NetBox 2.10.3 dump (about 600 MB, ~40k devices, ~280k interfaces, ~88k cables, ~90k its, ~14k prefixes) I'm trying to import.
Observed Behavior
Crashed about ~1% of the way through import.
Looking at NetBox from which the dump was exported, that particular rack is in site "ord1", so the error is seemingly accurate but I'm not clear on the context otherwise.
Steps to Reproduce
nautobot-server import_netbox_json /tmp/netbox_data.json 2.10.3
and then waitThe text was updated successfully, but these errors were encountered: