InterfaceModeChoices.MODE_TAGGED not working in 4.0.5 #9832

Closed
opened 2025-12-29 21:23:22 +01:00 by adam · 0 comments
Owner

Originally created by @balpoint on GitHub (Jun 12, 2024).

Deployment Type

Self-hosted

NetBox Version

v4.0.5

Python Version

3.10

Steps to Reproduce

Hi i have a script within Netbox and one of the things i do with the script is let my team fill out a form to configure specific interface parameters. One of these paramaters is interface mode, i do that as followed (cutdown version for lenght and clarity purposes):

class editMode(Script):
    class Meta:
        name = "Edit Mode "
        description = "Change interface mode"
        commit_default = False
        field_order = ['mode']
    mode = ChoiceVar (
        required = False,
        choices=[(InterfaceModeChoices.MODE_ACCESS, "Access"), (InterfaceModeChoices.MODE_TAGGED, "Tagged")]
    )
    interface = ObjectVar(
        model = Interface,
        required = True
    )
    def run(self, data, commit):
        interface = data['interface']
        mode = data['mode']
        mode_changed = False
        if 'mode' in data and mode in [InterfaceModeChoices.MODE_ACCESS, InterfaceModeChoices.MODE_TAGGED]:
            mode_changed = True
            interface.mode = mode
        interface.save()
        if mode_changed:
            self.log_success(f"The mode of interface {interfacce.name} has been changed to {mode}.")

Downgrading Netbox from 4.0.5 to 4.0.2 and everything works as it always has, cannot find any change related to this behavior.

Expected Behavior

The expected behavior is that 802.1Q Mode for the selected interface changes to tagged, for access this works fine.

Observed Behavior

The observed behavior is that whenever tagged is selected the script completes succesful but no change is made on the selected interface. No errors, even in debug mode there is no indication that anything is wrong, it simply does not do anything.

Downgrading Netbox from 4.0.5 to 4.0.2 and everything works as it always has, cannot find any change related to this behavior.

Originally created by @balpoint on GitHub (Jun 12, 2024). ### Deployment Type Self-hosted ### NetBox Version v4.0.5 ### Python Version 3.10 ### Steps to Reproduce Hi i have a script within Netbox and one of the things i do with the script is let my team fill out a form to configure specific interface parameters. One of these paramaters is interface mode, i do that as followed (cutdown version for lenght and clarity purposes): ``` class editMode(Script): class Meta: name = "Edit Mode " description = "Change interface mode" commit_default = False field_order = ['mode'] mode = ChoiceVar ( required = False, choices=[(InterfaceModeChoices.MODE_ACCESS, "Access"), (InterfaceModeChoices.MODE_TAGGED, "Tagged")] ) interface = ObjectVar( model = Interface, required = True ) def run(self, data, commit): interface = data['interface'] mode = data['mode'] mode_changed = False if 'mode' in data and mode in [InterfaceModeChoices.MODE_ACCESS, InterfaceModeChoices.MODE_TAGGED]: mode_changed = True interface.mode = mode interface.save() if mode_changed: self.log_success(f"The mode of interface {interfacce.name} has been changed to {mode}.") ``` Downgrading Netbox from 4.0.5 to 4.0.2 and everything works as it always has, cannot find any change related to this behavior. ### Expected Behavior The expected behavior is that 802.1Q Mode for the selected interface changes to tagged, for access this works fine. ### Observed Behavior The observed behavior is that whenever tagged is selected the script completes succesful but no change is made on the selected interface. No errors, even in debug mode there is no indication that anything is wrong, it simply does not do anything. Downgrading Netbox from 4.0.5 to 4.0.2 and everything works as it always has, cannot find any change related to this behavior.
adam closed this issue 2025-12-29 21:23:23 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#9832