nautobot / nautobot-app-ssot

Single Source of Truth for Nautobot
https://docs.nautobot.com/projects/ssot/en/latest/
Other
37 stars 35 forks source link

SSoT NAUTOBOT - IPFABRIC: django.core.exceptions.ValidationError #240

Closed lmalar closed 11 months ago

lmalar commented 1 year ago

Hi, I can't finish syncing NAUTOBOT (v1.6.3) with IPFABRIC (v6.3.1). The plugin NAUTOBOT-SSOT-IPFABRIC (v2.0.2) always ends with the same error.

Traceback (most recent call last):
  File "/opt/nautobot/lib64/python3.8/site-packages/nautobot_ssot/jobs/base.py", line 337, in run
    self.sync_data()
  File "/opt/nautobot/lib64/python3.8/site-packages/nautobot_ssot/integrations/ipfabric/jobs.py", line 285, in sync_data
    dest.sync_from(ipfabric_source)
  File "/opt/nautobot/lib64/python3.8/site-packages/diffsync/__init__.py", line 561, in sync_from
    result = syncer.perform_sync()
  File "/opt/nautobot/lib64/python3.8/site-packages/diffsync/helpers.py", line 327, in perform_sync
    changed |= self.sync_diff_element(element)
  File "/opt/nautobot/lib64/python3.8/site-packages/diffsync/helpers.py", line 391, in sync_diff_element
    changed |= self.sync_diff_element(child, parent_model=dst_model)
  File "/opt/nautobot/lib64/python3.8/site-packages/diffsync/helpers.py", line 367, in sync_diff_element
    changed, modified_model = self.sync_model(src_model=src_model, dst_model=dst_model, ids=ids, attrs=attrs)
  File "/opt/nautobot/lib64/python3.8/site-packages/diffsync/helpers.py", line 424, in sync_model
    dst_model = dst_model.delete()
  File "/opt/nautobot/lib64/python3.8/site-packages/nautobot_ssot/integrations/ipfabric/diffsync/diffsync_models.py", line 432, in delete
    self.safe_delete(
  File "/opt/nautobot/lib64/python3.8/site-packages/nautobot_ssot/integrations/ipfabric/diffsync/diffsync_models.py", line 84, in safe_delete
    tonb_nbutils.tag_object(nautobot_object=nautobot_object, custom_field="ssot-synced-from-ipfabric")
  File "/opt/nautobot/lib64/python3.8/site-packages/nautobot_ssot/integrations/ipfabric/utilities/nbutils.py", line 256, in tag_object
    _tag_object(nautobot_object)
  File "/opt/nautobot/lib64/python3.8/site-packages/nautobot_ssot/integrations/ipfabric/utilities/nbutils.py", line 254, in _tag_object
    nautobot_object.validated_save()
  File "/opt/nautobot/lib64/python3.8/site-packages/nautobot/core/models/__init__.py", line 79, in validated_save
    self.full_clean()
  File "/opt/nautobot/lib64/python3.8/site-packages/django/db/models/base.py", line 1251, in full_clean
    raise ValidationError(errors)
django.core.exceptions.ValidationError: {'status': ["status instance with id UUID('cf4428a4-5d7a-45c4-b43c-0c64bccdae62') does not exist."]}

Traceback (most recent call last):
  File "/opt/nautobot/lib64/python3.8/site-packages/nautobot_ssot/jobs/base.py", line 337, in run
    self.sync_data()
  File "/opt/nautobot/lib64/python3.8/site-packages/nautobot_ssot/integrations/ipfabric/jobs.py", line 285, in sync_data
    dest.sync_from(ipfabric_source)
  File "/opt/nautobot/lib64/python3.8/site-packages/diffsync/__init__.py", line 561, in sync_from
    result = syncer.perform_sync()
  File "/opt/nautobot/lib64/python3.8/site-packages/diffsync/helpers.py", line 327, in perform_sync
    changed |= self.sync_diff_element(element)
  File "/opt/nautobot/lib64/python3.8/site-packages/diffsync/helpers.py", line 391, in sync_diff_element
    changed |= self.sync_diff_element(child, parent_model=dst_model)
  File "/opt/nautobot/lib64/python3.8/site-packages/diffsync/helpers.py", line 367, in sync_diff_element
    changed, modified_model = self.sync_model(src_model=src_model, dst_model=dst_model, ids=ids, attrs=attrs)
  File "/opt/nautobot/lib64/python3.8/site-packages/diffsync/helpers.py", line 424, in sync_model
    dst_model = dst_model.delete()
  File "/opt/nautobot/lib64/python3.8/site-packages/nautobot_ssot/integrations/ipfabric/diffsync/diffsync_models.py", line 432, in delete
    self.safe_delete(
  File "/opt/nautobot/lib64/python3.8/site-packages/nautobot_ssot/integrations/ipfabric/diffsync/diffsync_models.py", line 84, in safe_delete
    tonb_nbutils.tag_object(nautobot_object=nautobot_object, custom_field="ssot-synced-from-ipfabric")
  File "/opt/nautobot/lib64/python3.8/site-packages/nautobot_ssot/integrations/ipfabric/utilities/nbutils.py", line 256, in tag_object
    _tag_object(nautobot_object)
  File "/opt/nautobot/lib64/python3.8/site-packages/nautobot_ssot/integrations/ipfabric/utilities/nbutils.py", line 254, in _tag_object
    nautobot_object.validated_save()
  File "/opt/nautobot/lib64/python3.8/site-packages/nautobot/core/models/__init__.py", line 79, in validated_save
    self.full_clean()
  File "/opt/nautobot/lib64/python3.8/site-packages/django/db/models/base.py", line 1251, in full_clean
    raise ValidationError(errors)
django.core.exceptions.ValidationError: {'status': ["status instance with id UUID('cf4428a4-5d7a-45c4-b43c-0c64bccdae62') does not exist."]}
glennmatthews commented 1 year ago

Might need to move this issue to the nautobot-ssot repository, but as a guess, there is a Status involved in the sync whose assigned content-types (object types) are not correctly including the type of object it's being used with.

Kircheneer commented 1 year ago

@alhogan is this solved by #239?

alhogan commented 1 year ago

@alhogan is this solved by #239?

Yes, #239 will resolve this issue.

ghost commented 11 months ago

Is this going to be merged to develop? https://github.com/nautobot/nautobot-plugin-ssot/tree/ltm-1.6 is 32 commits behind.

Also running into this issue.

Kircheneer commented 11 months ago

Now being fixed through #246

Kircheneer commented 11 months ago

Definitely going into develop, if there is need we can backport to the LTM branch