Skip to content

Custom scripts in symlinked path don't work #19655

@llamafilm

Description

@llamafilm

Deployment Type

Self-hosted

NetBox Version

v4.3.1

Python Version

3.10

Steps to Reproduce

  1. Install Netbox 4.3.1, following the instructions to use a symlinked path /opt/netbox
  2. Create a custom script from the /extras/scripts/add webpage
  3. Run the script

Expected Behavior

it should work

Observed Behavior

Script fails with no error message shown.

When you enable debug level logging for netbox.data_backends it shows this:

netbox.data_backends[9596]: Failed to load script: connect_power error: The joined path (/opt/netbox/netbox/scripts/connect_power.py) is located outside of the base path component (/opt/netbox-4.3.1/netbox/scripts)

Image

I first saw this issue on my prod Netbox after upgrading to 4.3.1 and creating a new script. All my old scripts still work fine. I reproduced the issue on a fresh install. In this case, I didn't customize anything, just used all the defaults, including the recommendation for symlinking /opt/netbox.

Here is the difference between the new broken script and an older, working script on my prod instance:

netbox=> SELECT id,data_path,file_path,data_file_id,data_source_id,auto_sync_enabled FROM core_managedfile ORDER BY CREATED DESC LIMIT 2;
 id  |             data_path              |                  file_path                  | data_file_id | data_source_id | auto_sync_enabled 
-----+------------------------------------+---------------------------------------------+--------------+----------------+-------------------
 208 |                                    | /opt/netbox/netbox/scripts/connect_power.py |              |                | f
 206 | scripts/import_terrier_mactable.py | import_terrier_mactable.py                  |         7727 |             35 | t

Metadata

Metadata

Assignees

Labels

severity: mediumResults in substantial degraded or broken functionality for specfic workflowsstatus: acceptedThis issue has been accepted for 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