From f39debae3a7b7b95d90cd98dab782392bf051cf8 Mon Sep 17 00:00:00 2001 From: Marcus Weiner Date: Sun, 22 Sep 2024 23:03:59 +0200 Subject: [PATCH] Fix ethertype assembly --- ubiquiti-edge-router.j2 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ubiquiti-edge-router.j2 b/ubiquiti-edge-router.j2 index cc41058..ce326a7 100644 --- a/ubiquiti-edge-router.j2 +++ b/ubiquiti-edge-router.j2 @@ -6,7 +6,11 @@ {% set device = dcim.Device.objects.get(pk=device_id) %} {% endif %} -{%- set ether_types = [y[0] for x in dcim.InterfaceTypeChoices.CHOICES for y in x[1] if x[0].startswith('Ethernet')] %} +{# cursed pipeline to get all possible ethernet-like type #} +{%- set ether_types = dcim.Interface._meta.get_field("type").choices | + selectattr(0, "in", ["Ethernet (fixed)", "Ethernet (modular)", "Ethernet (backplane)"]) | + map(attribute=1) | sum(start=[]) | map(attribute=0) | list +%} {%- for intf in device.interfaces.all() %}