nautobot / nautobot-app-device-onboarding

Device Onboarding Plugin for Nautobot
https://docs.nautobot.com/projects/device-onboarding/en/latest/
Other
44 stars 31 forks source link

Update SSOT dependency to 3.0.0 #225

Closed mattmiller87 closed 2 months ago

mattmiller87 commented 2 months ago

Dependencies in SSOT and nautobot-secrets-providers aren't aligning in the new mgdsvc-nautobot image. Updating to use the new SSOT release for dependency matching.

mattmiller87 commented 2 months ago

Ah, this requires diffsync to go to 3.0.0 which is currently at 2.0.0.

scetron commented 2 months ago

I had done a small bit of testing with Diffsync 3.0 and an old branch of SSoT. You should be able to remove the direct dependency and rely on SSoT (I think) for this.

gsnider2195 commented 2 months ago

There's a bug in diffsync 2.0's class reference for diffsync.DiffSync here that's causing this project to fail on import. There's also an undocumented breaking change in diffsync 2.0 that changed the signature for DiffSyncModel.create from a diffsync kwarg to an adapter kwarg and changing the diffsync model attr to adapter. That change required making a number of changes to this code base. There are still more changes required to get this working and I think they're related to the pydantic upgrade:

2024-08-30 18:20:10,302 - celery.app.trace - ERROR - Task nautobot.extras.jobs.run_job[0b95778b-7363-4c81-902c-0b8e032ebf66] raised unexpected: ValueError("Parameters: {'name': 'demo-cisco-1', 'serial': '9ABUXU581111', 'pk': UUID('4c6f94ba-8a41-4274-8a3d-ac36b87455db')}")
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/nautobot_ssot/contrib/adapter.py", line 147, in _load_single_object
    diffsync_model = diffsync_model(**parameters)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pydantic/main.py", line 193, in __init__
    self.__pydantic_validator__.validate_python(data, self_instance=self)
pydantic_core._pydantic_core.ValidationError: 1 validation error for SyncNetworkDataDevice
last_network_data_sync
  Field required [type=missing, input_value={'name': 'demo-cisco-1', ...274-8a3d-ac36b87455db')}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.8/v/missing

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/celery/app/trace.py", line 477, in trace_task
    R = retval = fun(*args, **kwargs)
                 ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/nautobot/extras/jobs.py", line 1136, in run_job
    result = job(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/nautobot/extras/jobs.py", line 149, in __call__
    return self.run(*args, **deserialized_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/source/nautobot_device_onboarding/jobs.py", line 692, in run
    super().run(dryrun, memory_profiling, *args, **kwargs)
  File "/usr/local/lib/python3.11/site-packages/nautobot_ssot/jobs/base.py", line 314, in run
    self.sync_data(memory_profiling)
  File "/usr/local/lib/python3.11/site-packages/nautobot_ssot/jobs/base.py", line 142, in sync_data
    self.load_target_adapter()
  File "/source/nautobot_device_onboarding/jobs.py", line 594, in load_target_adapter
    self.target_adapter.load()
  File "/source/nautobot_device_onboarding/diffsync/adapters/sync_network_data_adapters.py", line 312, in load
    self._load_objects(diffsync_model)
  File "/source/nautobot_device_onboarding/diffsync/adapters/sync_network_data_adapters.py", line 33, in _load_objects
    self._load_single_object(database_object, diffsync_model, parameter_names)
  File "/usr/local/lib/python3.11/site-packages/nautobot_ssot/contrib/adapter.py", line 149, in _load_single_object
    raise ValueError(f"Parameters: {parameters}") from error
ValueError: Parameters: {'name': 'demo-cisco-1', 'serial': '9ABUXU581111', 'pk': UUID('4c6f94ba-8a41-4274-8a3d-ac36b87455db')}

If anybody more familiar with this app would like to pick this up and finish it my work is committed in a branch https://github.com/nautobot/nautobot-app-device-onboarding/tree/u/gas-ssot-3.0

gsnider2195 commented 2 months ago

I made the required changes to update to ssot v3.0 in this pr