openwisp / openwisp/netjsonconfig
[backward-conversion] Recognize templates
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 388
- Forks
- 87
- Avg merge
- 1h 26m
- Merged PRs (30d)
- 4
Description
There's an issue with the backward conversion which I did not consider in the beginning.
Imagine the situation in which the configuration of a device is converted to NetJSON and sent to an openwisp2 instance.
Case 1) First registration
The system gets a NetJSON containing the full configuration, which will be inserted in the config field, BUT will override any configuration present in templates that are either set as default or are set in a second step by a user.
Case 2) Updates
Imagine an already registered OpenWRT device. A local user logs in via SSH or luci and updates some configurations. Some magic trick then detects the configuration changes and sends the updated NetJSON full configuration to the server.
Without an appropriate mechanism, the configuration present in templates will be duplicated in the main config field
In short
The library needs to understand how to handle both cases, in the first, if same configuration keys are present both in the local conf and in templates, the templates win and the local conf values are discarded.
In the second case, local conf values are discarded only if they are equal to the same values present in the values of templates.
Challenges
I'm noting down challenges regarding this task.
Recognize variables
When a configuration is received, if the content of a configuration option matches the content of a variable in a template, it should be recognized as the template, not as a custom local configuration that needs to be stored.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the backward-conversion path and how templates and local configuration values are represented. Compare first registration with later updates, focusing on matching configuration keys and template variables. Done means template values win on registration and unchanged local values are not duplicated during updates, with coverage for both cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- networking
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100