Use datasource file as custom validator #8796

Closed
opened 2025-12-29 20:41:16 +01:00 by adam · 2 comments
Owner

Originally created by @kuhball on GitHub (Nov 1, 2023).

NetBox version

v3.6.4

Python version

3.10

Steps to Reproduce

  1. Create a datasource containing a custom validator class within a python file
  2. Import the class within the gui via admin / current config using the displayed path within the datasource
  3. Try to create / edit the model the validator is applied to

Expected Behavior

The class can be imported and used as a validator analog to custom scripts.

Due to the new admin menu the current config and custom validator settings can be accessed from the ui. This would make a great addition to reduce manual configuration within the netbox host.

Not sure if this correctly classified as a bug or rather a FR.

Observed Behavior

The class cannot be found when using the displayed path from the ui.

Originally created by @kuhball on GitHub (Nov 1, 2023). ### NetBox version v3.6.4 ### Python version 3.10 ### Steps to Reproduce 1. Create a datasource containing a custom validator class within a python file 2. Import the class within the gui via admin / current config using the displayed path within the datasource 3. Try to create / edit the model the validator is applied to ### Expected Behavior The class can be imported and used as a validator analog to custom scripts. Due to the new admin menu the current config and custom validator settings can be accessed from the ui. This would make a great addition to reduce manual configuration within the netbox host. Not sure if this correctly classified as a bug or rather a FR. ### Observed Behavior The class cannot be found when using the displayed path from the ui.
adam closed this issue 2025-12-29 20:41:16 +01:00
Author
Owner

@WatchTower001110 commented on GitHub (Nov 1, 2023):

https://github.com/netbox-community/netbox/issues/14158#issue-1971881079(url)

@WatchTower001110 commented on GitHub (Nov 1, 2023): https://github.com/netbox-community/netbox/issues/14158#issue-1971881079(url)
Author
Owner

@jeremystretch commented on GitHub (Nov 1, 2023):

What you're trying to do is not supported. Custom validator classes must be loaded into the Python virtual environment at runtime; they cannot be read from a remote file.

@jeremystretch commented on GitHub (Nov 1, 2023): What you're trying to do is not supported. Custom validator classes must be loaded into the Python virtual environment at runtime; they cannot be read from a remote file.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#8796