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

[update-config] Avoid removing all sections installed via openwisp before reapplying them #71

Closed
nemesifier opened this issue Oct 5, 2018 · 0 comments
Assignees

Comments

@nemesifier
Copy link
Member

This proposal should help to fix #69 as well.

The current update configuration algorithm uses a (dangerous) shortcut - totally my fault.

In order to remove specific UCI configuration that may be removed from the OpenWISP web interface, it loops over a stored copy of the previous UCI configuration downloaded from openwisp and removes all those options from the current active configuration. This basically removes everything that was sent via OpenWISP.
Once that is done, it applies the new configuration, adding all the options present in the new downloaded conf to the active conf of the device.

This is causing #69 but can may also cause unexpected problems if the process halts for some reason, although this case is now be prevented by da41186, but still, there are very good reasons to make this algorithm smarter.

I think the following should work:

  • loop over the sections and options (for each section also loop over its options) of the previous ow2 configuration (in /etc/openwisp/stored)
  • look for each specific section and its options in the new configuration that has just been downloaded from OpenWISP and if one of these is not found it means that section/option has been removed from the OpenWISP web UI and it can be safely removed from the current active configuration
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

2 participants