Skip to content

Update documentation to Netbox 4.3 #249

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
theguy147 opened this issue May 8, 2025 · 3 comments · May be fixed by #266
Open

Update documentation to Netbox 4.3 #249

theguy147 opened this issue May 8, 2025 · 3 comments · May be fixed by #266
Assignees
Labels
status: accepted type: documentation A change or addition to the documentation
Milestone

Comments

@theguy147
Copy link

theguy147 commented May 8, 2025

Change Type

Correction

Proposed Changes

Since netbox-community/netbox@d4f8cb7, netbox.configuration has changed DATABASE to DATABASES (plural). This change should be reflected in this plugins setup documentation.

Therefore the following change in the local_settings.py is required for netbox >= 4.3:

-from .configuration import DATABASE
+from .configuration import DATABASES
# ...
-DATABASES = DynamicSchemaDict({
-    'default': DATABASE,
-})
+DATABASES = DynamicSchemaDict(DATABASES)
@theguy147 theguy147 added type: documentation A change or addition to the documentation status: needs triage This issue is awaiting triage by a maintainer labels May 8, 2025
@jeremystretch jeremystretch added status: needs owner and removed status: needs triage This issue is awaiting triage by a maintainer labels May 8, 2025
@jeremystretch jeremystretch added this to the v0.6.0 milestone May 14, 2025
@arthanson
Copy link
Contributor

Note: This is not required, it is backwards compatible so the old settings will still work.

@theguy147
Copy link
Author

theguy147 commented May 22, 2025

Well, it crashes for me with an import exception without this update...

EDIT: how can it be backward compatible if the variable DATABASE doesn't exist anymore in the configuration.py? Or am I misunderstanding your comment?

Maybe you mean that for users who update netbox there is no need to update the configuration.py at all and then the DATABASE variable can be imported? But at least for people who do a fresh install or who also update the config this will not work anymore...

@theguy147
Copy link
Author

theguy147 commented May 22, 2025

So maybe something like this is better? :)

# ...
-from .configuration import DATABASE
-DATABASES = DynamicSchemaDict({
-    'default': DATABASE,
-})
+try:
+  from .configuration import DATABASES
+  DATABASES = DynamicSchemaDict(DATABASES)
+except ImportError:
+  from .configuration import DATABASE
+  DATABASES = DynamicSchemaDict({
+      'default': DATABASE,
+  })
# ...

or the other way around: first trying to import DATABASE and if that fails trying DATABASES ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: accepted type: documentation A change or addition to the documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants