Skip to content

Error when import modules into device that doesn't have a name #19901

@sol1-matt

Description

@sol1-matt

Deployment Type

Self-hosted

NetBox Version

v4.3.4

Python Version

3.11

Steps to Reproduce

  1. Create device without a name and module bays named Bay 1 and Bay 2 in positions 1 and 2
{
    "id": 11531,
    "display": "ACME FOBOT Chassis 1 (11531)",
    "name": null,
    "device_type": {
        "id": 731,
        "display": "FOBOT Chassis 1",
        "manufacturer": {
            "id": 234,
            "display": "ACME",
            "name": "ACME",
            "slug": "acme",
        },
        "model": "FOBOT Chassis 1",
        "slug": "fobot-chassis-1",
  1. Create a module Module1234
  2. Import modules
device,module_bay,module_type,status
ACME FOBOT Chassis 1 (11531),"Bay 1",Module1234,planned

An error occurs:

Server Error
The complete exception is provided below: 

<class 'dcim.models.modules.Module.module_bay.RelatedObjectDoesNotExist'>

Module has no module_bay.

Python version: 3.11.2
NetBox version: 4.3.3

Additional steps
4. Edit the device and add a name to the device created in step 1 FOBOT 1
5. Import modules

device,module_bay,module_type,status
FOBOT 1,"Bay 1",Module1234,planned

The Module is added to device from import when the device has a name.

Expected Behavior

Netbox shouldn't throw a Server Error when importing devices without names.

The import should fail with a failure message telling the user you can't import to devices without a name but to use device.id instead.

Workaround
Import to the device.id instead of the device

device.id,module_bay,module_type,status
11531,"Bay 1",Module1234,planned

Observed Behavior

Server Error
The complete exception is provided below: 

<class 'dcim.models.modules.Module.module_bay.RelatedObjectDoesNotExist'>

Module has no module_bay.

Python version: 3.11.2
NetBox version: 4.3.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    netboxseverity: lowDoes not significantly disrupt application functionality, or a workaround is availablestatus: needs ownerThis issue is tentatively accepted pending a volunteer committed to its implementationtype: bugA confirmed report of unexpected behavior in the application

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions