nautobot / nautobot-plugin-ssot-ipfabric

Nautobot SSoT IP Fabric
https://nautobot.github.io/nautobot-plugin-ssot-ipfabric/
Other
8 stars 2 forks source link

Safe Delete Mode Disabled throws Error #115

Closed ghost closed 1 year ago

ghost commented 1 year ago

Environment

Expected Behavior

SSOT errors when Safe Delete Mode is not enabled.

Observed Behavior

  File "/opt/nautobot/lib/python3.9/site-packages/nautobot_ssot/jobs/base.py", line 332, in run
    self.sync_data()
  File "/opt/nautobot/lib/python3.9/site-packages/nautobot_ssot_ipfabric/jobs.py", line 277, in sync_data
    dest.sync_from(ipfabric_source)
  File "/opt/nautobot/lib/python3.9/site-packages/diffsync/__init__.py", line 526, in sync_from
    self.sync_complete(source, diff, flags, syncer.base_logger)
  File "/opt/nautobot/lib/python3.9/site-packages/nautobot_ssot_ipfabric/diffsync/adapter_nautobot.py", line 72, in sync_complete
    nautobot_object.delete()
  File "/opt/nautobot/lib/python3.9/site-packages/django/db/models/base.py", line 960, in delete
    assert self.pk is not None, (
AssertionError: Interface object can't be deleted because its id attribute is set to None.

Steps to Reproduce

  1. Start new Sync
  2. Uncheck Safe Delete Mode
ghost commented 1 year ago

Happens when Nautobot has data or when Nautobot is completely empty. It seems it is trying to delete stuff in Nautobot that does not exists.

pke11y commented 1 year ago

Thanks @justinjeffery-ipf. I'll take a look.

alhogan commented 1 year ago

I've tested this and I believe this has been resolved. If this occurs again please open an issue in the nautobot-ssot repo.