nautobot / nautobot-app-ssot

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

Advanced Handling of Custom Fields #90

Open jdrew82 opened 1 year ago

jdrew82 commented 1 year ago

Environment

Expected Behavior

When a new CustomField needs to be added to a Nautobot object it should only be done once. Any value updates to CustomFields should be done in DiffSync model update method.

Observed Behavior

Any DiffSync model that has CustomFields as an attribute will have the update method called for every object when a new CustomField is added. This results in potentially hundreds or thousands of unnecessary updates.

Steps to Reproduce

  1. Setup Nautobot and SSoT.
  2. Setup DiffSyncModel with CustomFields as an attribute.
  3. Run import and update sync after adding a new CustomField.
Kircheneer commented 1 year ago

This is only applicable when you don't know ahead of time which exact custom fields to create.

A solution could be some kind of hook for run_once() on the adapter.

Another solution could be documenting a pattern where you defined an explicit model for things like this and only have one instance of this.