Skip to content

Saving Certain Fields that link to other objects causes exception errors #470

@d90

Description

@d90

Plugin Version

0.4.10

NetBox Version

4.4.8

Python Version

3.12.3

Steps to Reproduce

Environment

  • NetBox Version: 4.4.8
  • Python Version: 3.12.3
  • Plugin Version: 0.4.10 (issue appeared after upgrading from 0.4.6)

Custom Object Type Definitions

Based on my Netbox instance, here are the custom object types involved:

  1. SLB Custom Object (slbs)
  • Fields: name (string)
  • host_list (many-to-many IP addresses)
  • owner (FK to Contact)
  • ssl_reencryption (boolean)
  • vip (FK to IP Address)
  • gslb
  • aflex
  • snow_ref
  • location
  • partition
  • notes
  • description
  1. Health Monitor Custom Object (health-monitors)
  • Fields: Name (string)
  • method (choice: http/https)
  • mtls (boolean)
  • Port (integer)
  • response_code (array)
  • url_path (string)
  • url_type (choice: GET/POST)
  1. DVC Custom Object (dvcs)
  • Fields: (domain validation control object)
  1. SSL Profile Custom Object (ssl-profiles)
  • Fields:
    • name (string)
    • cert_type (string)
    • comments (text)
    • dcv (FK to DVC custom object) - nullable
    • expiration_date (date)
    • health_monitor (FK to Health Monitor custom object) - nullable
    • renew_time (datetime)
    • slb_config (FK to SLB custom object) - required
    • sni_default (boolean)
    • snow_reference (string)
    • subject_alternate_name (string)

Reproduction Steps

  1. Create an SLB custom object:
    POST /api/plugins/custom-objects/slbs/
    {
    "name": "test-example.rutgers.edu",
    "ssl_reencryption": true,
    "partition": "EI-PS",
    "vip": <ip_address_id>,
    "host_list": [<ip_address_id>]
    }
  2. Note the returned ID (e.g., id: 100)
  3. Create a Health Monitor custom object (optional):
    POST /api/plugins/custom-objects/health-monitors/
    {
    "Name": "test-example-https-monitor",
    "method": "https",
    "mtls": true,
    "Port": 443,
    "response_code": ["200", "301", "302"],
    "url_path": "/",
    "url_type": "GET"
    }
  4. Note the returned ID (e.g., id: 50)
  5. Create an SSL Profile linking to the SLB:
    POST /api/plugins/custom-objects/ssl-profiles/
    {
    "name": "test-example.rutgers.edu",
    "cert_type": "14404",
    "expiration_date": "2026-12-31",
    "slb_config": 100,
    "health_monitor": 50,
    "sni_default": true
    }
  6. Attempt to edit and save the SSL Profile through the UI (API untested):
    - Modify any field (e.g., change sni_default to false)
    - Save the object

Upgrade NCO from 0.4.6 to 0.4.7, 0.4.8, 0.4.9, and finally 0.4.10.

Over time saving ssl profile causes the error. Restarting netbox fixes this for a period of time.

Expected Behavior

Saving ssl profiles causes no error.

Observed Behavior

The complete exception is provided below:

<class 'ValueError'>

Cannot assign "<Table2Model: dev-arc.rutgers.edu>": "Table3Model.slb_config" must be a "Table2Model" instance.

Python version: 3.12.3
NetBox version: 4.4.8-Docker-3.4.2
Plugins: 
  netbox_custom_objects: 0.4.10
  netbox_floorplan: 0.8.0
  netbox_topology_views: 4.5.0

observed at startup

9 objects could not be automatically imported:                                                                                                                                                                                                           
database.models.Table3Model
 
database.models.Table2Model
 
database.mcdels.Trble36Model

database.models.Table1Model

database.models.Table3Model

database.models.Table2Model

netbox_custom_objects.models.Through_custom_objects_2_host_list 

database.models.Table36Model

database.models.Table1Model

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions