Closed tsm1th closed 3 months ago
Can you add a test to cover what this actually fixes?
@joewesch - The solution here was much simpler than I realized. The original issue stemmed from trying to rely on data from the termination object's parent to generate a __str__
method. This is not how nautobot does it. The termination object itself has a display
attribute that handles this. This is viewable in the api when you look at a dcim.interface
, circuits.circuittermination
, or other termination object type.
TLDR - There was no reason to generate our own __str__
method using the parent of the termination object.
I updated the test that was checking this (to include the display
attribute) and renamed it to more accurately demonstrate what it's doing.
This closes #222.
The other termination type includes the identifier
name
in the original API call, so it's not an issue. For a circuit termination type, the identifiercircuit.cid
is not in the original API call. That's why an additional fetch is necessary.Pynautobot usually handles this with the
__getattr__
method. However, this does not work in this case because theCircuit
object has not been initialized yet. Once initialized viafull_details()
, the__getattr__
works as expected.Another solution was to increase the
depth
param on the API call, but it added performance overhead that wasn't ideal.