Skip to content
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

SOCIAL_AUTH settings in custom configuration files, are not picked up in 3.1 beta1 #653

Closed
mnj opened this issue Nov 25, 2021 · 8 comments · Fixed by #657
Closed

SOCIAL_AUTH settings in custom configuration files, are not picked up in 3.1 beta1 #653

mnj opened this issue Nov 25, 2021 · 8 comments · Fixed by #657
Labels
bug This issue describes a confirmed bug.

Comments

@mnj
Copy link

mnj commented Nov 25, 2021

Current Behavior

Tried just adding them as:
SOCIAL_AUTH_AZUREAD_TENANT_OAUTH2_RESOURCE = 'xxx'
SOCIAL_AUTH_AZUREAD_TENANT_OAUTH2_KEY = 'xxx'
SOCIAL_AUTH_AZUREAD_TENANT_OAUTH2_SECRET = 'xxx'
SOCIAL_AUTH_AZUREAD_TENANT_OAUTH2_TENANT_ID = 'xxx'
to extra.py in /etc/netbox/config/

Changing other variables like ADMIN_USERS in extra.py works fine, so the file itself is getting read, just not these specific variables.

They didn't show up in the django debug toolbar.

I'm guessing it's related to how the latest netbox reads the specific variables:
netbox-community/netbox@200aca4#diff-310332579486e53e626dd095399f64c29fc215b386672af995b764f78328d27e

Expected Behavior

Expected the settings to be picked up, and listed in the django debug toolbar (settings).

Docker Compose Version

N/A (used the netboxcommunity/netbox:v3.1-beta1 image on docker hub)

Docker Version

Running in AKS in Azure, not applicable.

The git Revision

netboxcommunity/netbox:v3.1-beta1

The git Status

N/A

Startup Command

N/A

NetBox Logs

❯ kubectl -n netbox-dev logs netbox-dev-6699d958df-hkd9g
↩️ Skip creating the superuser
🧬 loaded config '/etc/netbox/config/configuration.py'
🧬 loaded config '/etc/netbox/config/extra.py'
🧬 loaded config '/etc/netbox/config/logging.py'
🧬 loaded config '/etc/netbox/config/plugins.py'
▶️  Running the startup script /opt/netbox/startup_scripts/000_users.py
▶️  Running the startup script /opt/netbox/startup_scripts/010_groups.py
▶️  Running the startup script /opt/netbox/startup_scripts/015_object_permissions.py
▶️  Running the startup script /opt/netbox/startup_scripts/020_custom_fields.py
▶️  Running the startup script /opt/netbox/startup_scripts/020_tags.py
▶️  Running the startup script /opt/netbox/startup_scripts/020_tenant_groups.py
▶️  Running the startup script /opt/netbox/startup_scripts/030_regions.py
▶️  Running the startup script /opt/netbox/startup_scripts/030_tenants.py
▶️  Running the startup script /opt/netbox/startup_scripts/040_sites.py
▶️  Running the startup script /opt/netbox/startup_scripts/050_manufacturers.py
▶️  Running the startup script /opt/netbox/startup_scripts/060_device_types.py
▶️  Running the startup script /opt/netbox/startup_scripts/070_rack_roles.py
▶️  Running the startup script /opt/netbox/startup_scripts/075_locations.py
▶️  Running the startup script /opt/netbox/startup_scripts/080_racks.py
▶️  Running the startup script /opt/netbox/startup_scripts/090_device_roles.py
▶️  Running the startup script /opt/netbox/startup_scripts/100_platforms.py
▶️  Running the startup script /opt/netbox/startup_scripts/130_cluster_types.py
▶️  Running the startup script /opt/netbox/startup_scripts/135_cluster_groups.py
▶️  Running the startup script /opt/netbox/startup_scripts/135_clusters.py
▶️  Running the startup script /opt/netbox/startup_scripts/140_clusters.py
▶️  Running the startup script /opt/netbox/startup_scripts/140_devices.py
▶️  Running the startup script /opt/netbox/startup_scripts/150_rirs.py
▶️  Running the startup script /opt/netbox/startup_scripts/160_aggregates.py
▶️  Running the startup script /opt/netbox/startup_scripts/165_cluster_groups.py
▶️  Running the startup script /opt/netbox/startup_scripts/175_route_targets.py
▶️  Running the startup script /opt/netbox/startup_scripts/180_vrfs.py
▶️  Running the startup script /opt/netbox/startup_scripts/190_prefix_vlan_roles.py
▶️  Running the startup script /opt/netbox/startup_scripts/200_vlan_groups.py
▶️  Running the startup script /opt/netbox/startup_scripts/210_vlans.py
▶️  Running the startup script /opt/netbox/startup_scripts/220_prefixes.py
▶️  Running the startup script /opt/netbox/startup_scripts/230_virtual_machines.py
▶️  Running the startup script /opt/netbox/startup_scripts/240_virtualization_interfaces.py
▶️  Running the startup script /opt/netbox/startup_scripts/250_dcim_interfaces.py
▶️  Running the startup script /opt/netbox/startup_scripts/260_ip_addresses.py
▶️  Running the startup script /opt/netbox/startup_scripts/270_primary_ips.py
▶️  Running the startup script /opt/netbox/startup_scripts/280_custom_links.py
▶️  Running the startup script /opt/netbox/startup_scripts/280_providers.py
▶️  Running the startup script /opt/netbox/startup_scripts/290_circuit_types.py
▶️  Running the startup script /opt/netbox/startup_scripts/290_webhooks.py
▶️  Running the startup script /opt/netbox/startup_scripts/300_circuits.py
▶️  Running the startup script /opt/netbox/startup_scripts/320_services.py
▶️  Running the startup script /opt/netbox/startup_scripts/330_power_panels.py
▶️  Running the startup script /opt/netbox/startup_scripts/340_power_feeds.py
✅ Initialisation is done.
⏳ Waiting for control socket to be created... (1/10)
2021/11/25 13:53:25 [info] 6#6 unit started
2021/11/25 13:53:25 [info] 14#14 discovery started
2021/11/25 13:53:25 [notice] 14#14 module: python 3.9.5 "/usr/lib/unit/modules/python3.unit.so"
2021/11/25 13:53:25 [info] 6#6 controller started
2021/11/25 13:53:25 [notice] 6#6 process 14 exited with code 0
2021/11/25 13:53:25 [info] 16#16 router started
2021/11/25 13:53:25 [info] 16#16 OpenSSL 1.1.1l  24 Aug 2021, 101010cf
⚙️ Applying configuration from /etc/unit/nginx-unit.json
2021/11/25 13:53:26 [info] 20#20 "netbox" application started
✅ Unit configuration loaded successfully
2021/11/25 13:53:27 [notice] 6#6 process 12 exited with code 0
2021/11/25 13:53:29 [info] 25#25 "netbox" application started

Content of docker-compose.override.yml

N/A
@mnj mnj changed the title SOCIAL_AUTH settings in custom configuration files, are not picked up in 3.1 beta SOCIAL_AUTH settings in custom configuration files, are not picked up in 3.1 beta1 Nov 25, 2021
@mnj
Copy link
Author

mnj commented Nov 25, 2021

The only "working" solution I have found so far, is exec'ing into the container, adding:
globals()['SOCIAL_AUTH_AZUREAD_TENANT_OAUTH2_RESOURCE'] = 'xxx'
globals()['SOCIAL_AUTH_AZUREAD_TENANT_OAUTH2_KEY'] = 'xxx'
globals()['SOCIAL_AUTH_AZUREAD_TENANT_OAUTH2_SECRET'] = 'xxx'
globals()['SOCIAL_AUTH_AZUREAD_TENANT_OAUTH2_TENANT_ID'] = 'xxx'
to /opt/netbox/netbox/netbox/settings.py

killing the PID's of the unit processes for the netbox app, so not a super viable solution, but that way they work as expected.

@tobiasge
Copy link
Member

I think the problem is the missing __dir__ in our configuration loader. I patched it and have build an image with the new method included. Could you test that in you environment?
You can find the image here.

@mnj
Copy link
Author

mnj commented Nov 29, 2021

Thanks, sure I'll give it a spin tomorrow morning and post the results.

@mnj
Copy link
Author

mnj commented Nov 30, 2021

Tested it now, and it seems to work fine with the image you posted, so that seems to fix it :)

tobiasge added a commit to tobiasge/netbox-docker that referenced this issue Nov 30, 2021
tobiasge added a commit to cimnine/netbox-docker that referenced this issue Nov 30, 2021
@DanSheps
Copy link
Member

Thank you for opening a bug report. This bug appears to not be related to NetBox.

@cimnine cimnine reopened this Nov 30, 2021
@cimnine
Copy link
Collaborator

cimnine commented Nov 30, 2021

Hi Dan. This is the NetBox Docker repository and it was definitely related to our code for loading the configuration from multiple files. Tobias fixed it in #656. That's the only reason to close the issue. Cheers

@cimnine cimnine added the bug This issue describes a confirmed bug. label Nov 30, 2021
@DanSheps
Copy link
Member

DanSheps commented Dec 1, 2021

Whoops, lol, sorry about that, I wasn't paying attention. My bad

@mnj
Copy link
Author

mnj commented Dec 8, 2021

Now netbox v3.1 has been released, not just in beta, using the official 3.1 docker image, this fix in the develop branch doesn't seem to be included, do any of you have an idea, when those will be merged into master? (which is guess is what the images/tags on dockerhub is created from daily?).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue describes a confirmed bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants