Misuse of _ (underscore) inside DataSource.sync() #17713
Labels
severity: medium
Results in substantial degraded or broken functionality for specfic workflows
status: accepted
This issue has been accepted for implementation
type: bug
A confirmed report of unexpected behavior in the application
Deployment Type
Self-hosted
NetBox Version
v4.1.3
Python Version
3.12
Steps to Reproduce
UnboundLocalError
instead ofSyncError
. Also, the data source has the probability to get stuck in "syncing" state.It happens due to a common python mistake:
_
(underscore) is used as an alias to gettext._
(underscore).Python interprets this situation as "reference before assignment". For example, here will happen the same error:
Here is the full traceback:
Although the traceback is originally generated inside a plugin, I do believe the error is quite clear and not plugin-related. If you disagree, please let me know and I will provide the traceback without plugins.
Expected Behavior
Sync of the data source must generate
SyncError
if something goes wrong, but notUnboundLocalError
Observed Behavior
UnboundLocalError
was raisedThe text was updated successfully, but these errors were encountered: