Open jakubkrysl opened 1 year ago
Thanks for submitting! This would need to be handled in
DiffSync.add
DiffSync.update
DiffSync.get_or_instantiate
DiffSync.get_or_add_model_instance
DiffSync.update_or_instantiate
DiffSync.update_or_add_model_instance
As such, its probably best to handle this in the classes inheriting from BaseStore
as then it would only need to be handled for add
and update
.
Environment
Context
I have an Nautobot SSoT Job. There is an issue where DiffSync store handles objects by
uid
but later for diff switchesuid
forshortname
as name of the element: https://github.com/networktocode/diffsync/blob/b9b3b7a765499b79b37de0bbd36374ec5dc9767d/diffsync/__init__.py#L335-L346 But there is no way to check if givenshortname
is already used in DiffSync store while adding it, I can only check for uid. And when I run diff calculation, it fails onshortname
conflict, but catchingObjectAlreadyExists
at this point aborts whole diff calculation.Expected Behavior
Fail on step 2, DiffSync should not allow to add object to store if given shortname is already stored.
Observed Behavior
Fail on diff calculation, which is too late to do anything about it.
Steps to Reproduce