Skip to content
Discussion options

You must be logged in to vote

Are all the devices you are exporting "child" devices? My guess is you have some devices matching your filter that aren't "child" devices, which explains why the field doesn't exist on those. To prevent it from erroring, I believe you just need an if statement to check for device.parent_bay.

Example:

{%- if device.parent_bay -%}
Parent Device: {{ device.parent_bay.device.name }}
Parent Device Bay: {{ device.parent_bay }}
{%- endif -%}

If that doesn't work, you can check to see if it is a child device:

{%- if device.device_type.subdevice_role == "child" -%}
Parent Device: {{ device.parent_bay.device.name }}
Parent Device Bay: {{ device.parent_bay }}
{%- endif -%}

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@mkarel
Comment options

Answer selected by mkarel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants