Interface Role have extra entry 'r' #6429

Closed
opened 2025-12-29 19:40:37 +01:00 by adam · 2 comments
Owner

Originally created by @Domoninic on GitHub (Apr 30, 2022).

Originally assigned to: @kkthxbye-code on GitHub.

NetBox version

V3.2.2

Python version

3.8

Steps to Reproduce

1: Create / Edit IP address
2: Open Role Drop-down and scroll to bottom

Expected Behavior

Last entry is "CARP"

image

Observed Behavior

Last entry is "r"

image

This is observed in both local install and online Demo

Originally created by @Domoninic on GitHub (Apr 30, 2022). Originally assigned to: @kkthxbye-code on GitHub. ### NetBox version V3.2.2 ### Python version 3.8 ### Steps to Reproduce 1: Create / Edit IP address 2: Open Role Drop-down and scroll to bottom ### Expected Behavior Last entry is "CARP" ![image](https://user-images.githubusercontent.com/2497502/166116153-d646e08a-fc3d-413e-acfe-0c250274500d.png) ### Observed Behavior Last entry is "r" ![image](https://user-images.githubusercontent.com/2497502/166116051-4621c744-9b09-4a7e-96c2-19817eff8e18.png) This is observed in both local install and online Demo
adam added the type: bugstatus: accepted labels 2025-12-29 19:40:37 +01:00
adam closed this issue 2025-12-29 19:40:37 +01:00
Author
Owner

@steffenkremser commented on GitHub (May 2, 2022):

Seems to be a typo in b3ea007e0a

    CHOICES = (
        (ROLE_LOOPBACK, 'Loopback', 'gray'),
        (ROLE_SECONDARY, 'Secondary', 'blue'),
        (ROLE_ANYCAST, 'Anycast', 'yellow'),
        (ROLE_VIP, 'VIP', 'purple'),
        (ROLE_VRRP, 'VRRP', 'green'),
        (ROLE_HSRP, 'HSRP', 'green'),
        (ROLE_GLBP, 'GLBP', 'green'),
        (ROLE_CARP, 'CARP'), 'green',
    )

i.e. the ROLE_CARP tuple is closed prematurely (after just 2 elements)
.. the leftover literal 'green' is treated as a separate choice ['g','r','e',...]
.. and thus displayed as r (second element is display_value)

.. the obvious fix being

-        (ROLE_CARP, 'CARP'), 'green',
+        (ROLE_CARP, 'CARP', 'green'),
@steffenkremser commented on GitHub (May 2, 2022): Seems to be a typo in b3ea007e0a286ad414162a53b10dc248e134723f ```python CHOICES = ( (ROLE_LOOPBACK, 'Loopback', 'gray'), (ROLE_SECONDARY, 'Secondary', 'blue'), (ROLE_ANYCAST, 'Anycast', 'yellow'), (ROLE_VIP, 'VIP', 'purple'), (ROLE_VRRP, 'VRRP', 'green'), (ROLE_HSRP, 'HSRP', 'green'), (ROLE_GLBP, 'GLBP', 'green'), (ROLE_CARP, 'CARP'), 'green', ) ``` i.e. the `ROLE_CARP` tuple is closed prematurely (after just 2 elements) .. the leftover literal `'green'` is treated as a separate choice `['g','r','e',...]` .. and thus displayed as `r` (second element is display_value) .. the obvious fix being ```diff - (ROLE_CARP, 'CARP'), 'green', + (ROLE_CARP, 'CARP', 'green'), ```
Author
Owner

@kkthxbye-code commented on GitHub (May 2, 2022):

@steffenkremser - I submitted a PR. Thank you for doing the digging 👍

@kkthxbye-code commented on GitHub (May 2, 2022): @steffenkremser - I submitted a PR. Thank you for doing the digging 👍
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#6429