ConfigContexts Failed To Load After Updating Value on CustomField for 'dcim.devices' Object #2224

Closed
opened 2025-12-29 17:23:54 +01:00 by adam · 4 comments
Owner

Originally created by @bdlamprecht on GitHub (Dec 18, 2018).

Environment

  • Python version: 3.6.5
  • NetBox version: 2.5.1

Steps to Reproduce

Using pynetbox version 4.0.5, attempt to save a value of a predefined custom_field on the dcim.devices object and call the save() function. That completes successfully.

However, when browsing to the URL /dcim/devices/<pk>/config-context/, this error is subsequently displayed:

netbox_config_context_error

Expected Behavior

To display the compiled config_context form the local_config_data with the rest of the defined config_context data as appropriate.

Observed Behavior

The WebUI failed as well as all calls for the device in the API.

Other Comments

I'm not sure exactly where this error is occurring so please let me know what other information you need from me to reproduce the issue.

Originally created by @bdlamprecht on GitHub (Dec 18, 2018). ### Environment * Python version: 3.6.5 * NetBox version: 2.5.1 ### Steps to Reproduce Using `pynetbox` version `4.0.5`, attempt to save a value of a predefined `custom_field` on the `dcim.devices` object and call the `save()` function. That completes successfully. However, when browsing to the URL `/dcim/devices/<pk>/config-context/`, this error is subsequently displayed: ![netbox_config_context_error](https://user-images.githubusercontent.com/7783306/50183002-204dd100-02ce-11e9-8885-ea6fef1975d6.PNG) <!-- What did you expect to happen? --> ### Expected Behavior To display the compiled `config_context` form the `local_config_data` with the rest of the defined `config_context` data as appropriate. <!-- What happened instead? --> ### Observed Behavior The WebUI failed as well as all calls for the device in the API. ### Other Comments ### I'm not sure exactly _**where**_ this error is occurring so please let me know what other information you need from me to reproduce the issue.
adam closed this issue 2025-12-29 17:23:54 +01:00
Author
Owner

@bdlamprecht commented on GitHub (Dec 18, 2018):

This can be fixed by using the following code:

dev.local_context_data = {}
dev.save()

It appears that some type of validation is NOT taking place to allow only JSON-formatted data into local_context_data. Need to look around a little more at the core issue.

@bdlamprecht commented on GitHub (Dec 18, 2018): This can be fixed by using the following code: ``` dev.local_context_data = {} dev.save() ``` It appears that some type of validation is NOT taking place to allow only `JSON`-formatted data into `local_context_data`. Need to look around a little more at the core issue.
Author
Owner

@jeremystretch commented on GitHub (Dec 19, 2018):

Please provide the exact steps needed to recreate this bug without using pynetbox (a curl command is preferrable).

@jeremystretch commented on GitHub (Dec 19, 2018): Please provide the exact steps needed to recreate this bug without using pynetbox (a `curl` command is preferrable).
Author
Owner

@bdlamprecht commented on GitHub (Dec 19, 2018):

Let me see if I can figure out the translation from pynetbox into curl and I'll post submit the lines to recreate the error.

@bdlamprecht commented on GitHub (Dec 19, 2018): Let me see if I can figure out the translation from `pynetbox` into `curl` and I'll post submit the lines to recreate the error.
Author
Owner

@bdlamprecht commented on GitHub (Dec 19, 2018):

So I can't seem to find the commit where I saw this occur consistently (perhaps I didn't actually do a commit).

Since I've worked around the issue (it was me probably sending invalid data to the API), I'm going to close this bug report.

@bdlamprecht commented on GitHub (Dec 19, 2018): So I can't seem to find the commit where I saw this occur consistently (perhaps I didn't _**actually**_ do a commit). Since I've worked around the issue (it was me probably sending invalid data to the API), I'm going to close this bug report.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#2224