pynautobot icon indicating copy to clipboard operation
pynautobot copied to clipboard

Support include kwarg in the Endpoint.all() Method

Open jeffkala opened this issue 1 year ago • 1 comments

Today if you want to pull back all devices and include config_context data you must use the .filter call.

In the .all() call if you include the include kwarg it will fail

>>> nautobot.dcim.devices.all(include=['config_context'])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: Endpoint.all() got an unexpected keyword argument 'include'
>>> 

Workaround is to use .filter(include=["config_context"]) with no other filtering criteria.

>>> nautobot.dcim.devices.filter(include=['config_context'])
[<pynautobot.models.dcim.Devices ('demo-cisco-xe') at 0x7f5c64d07b90>, <pynautobot.models.dcim.Devices ('jeff-8000v') at 0x7f5c64d1f410>, <pynautobot.models.dcim.Devices ('nxos9k') at 0x7f5c64d25210>, <pynautobot.models.dcim.Devices ('veos') at 0x7f5c64d26dd0>]

jeffkala avatar Sep 19 '24 15:09 jeffkala