-
-
Notifications
You must be signed in to change notification settings - Fork 81
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.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Status