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] Create a backup of the local UCI configuration to be able to set it back to its original state #72

Closed
okraits opened this issue Oct 5, 2018 · 8 comments · Fixed by #144
Assignees
Labels
enhancement important Higher priority or release blocker

Comments

@okraits
Copy link
Member

okraits commented Oct 5, 2018

Right now openwisp-config doesn't keep a backup of the local UCI configuration (all files in /etc/config).

This can lead to situations where settings are lost:

  1. An existing section is modified by openwisp-config.
  2. The modifications are removed from the configuration tarball delivered by openwisp-controller.
  3. openwisp-config deletes this section instead of restoring the state it had before it was modified by OW2.

Thus a backup of the initial configuration should be created and restored when the modifications are removed.

@okraits okraits self-assigned this Oct 5, 2018
@nemesifier
Copy link
Member

Once this, #71 and #69 are fixed the config update process will be improved greatly!

@BlancLoup
Copy link

Problem:
IMHO that it's not the right way. The real problem is backup realized like "sysupgrade -b". Sysupgrade does not match "principles" of apply_configuration function. Apply_configuration does correct actions for "diff-like" configurations while sysupgrade saves the entire configuration (including /etc/config/openwisp).

Consequences:

  1. apply_configuration always restores /etc/config/openwisp that leads to openwisp agent restarting before restore process was completed. Integrity will be ruined.
  2. all daemons will be restarted even that is not need.

Solution (backup only files that will be changed, very simpled algorithm):

  1. check new configuration archive for files that will be changed:
    tar -ztf $configuration_archive_to_apply | sed 's/^///' > $list_of_files_will_be_changed
  2. create backup archive of files that will be changed
    tar -czvf $backup_of_current_files -T $list_of_files_will_be_changed

@okraits
Copy link
Member Author

okraits commented Nov 28, 2018

I don't understand what you're trying to say. The use of sysupgrade hasn't been changed and it's not involved here at all.

The issue addressed here is that if openwisp-config modifies an element twice then it has no history available to tell wether the element was originally either added or modified by openwisp-config. Thus it is not able to restore the original state. This change fixes that.

@BlancLoup
Copy link

Sorry... I mixed up a little bit.

@okraits
Copy link
Member Author

okraits commented Nov 29, 2018

If you have valid and serious concerns about my changes then please speak up and elaborate. It might be possible that I failed to get your point. Maybe @nemesisdesign can also add his take on this.

@nemesifier
Copy link
Member

@BlancLoup where you mixing this issue with #81?

@nemesifier nemesifier added the important Higher priority or release blocker label Dec 2, 2018
okraits added a commit to TDT-AG/openwisp-config that referenced this issue Jan 11, 2019
okraits added a commit to TDT-AG/openwisp-config that referenced this issue Apr 1, 2019
okraits added a commit to TDT-AG/openwisp-config that referenced this issue Apr 1, 2019
okraits added a commit to TDT-AG/openwisp-config that referenced this issue Apr 3, 2019
@Gobiviswa
Copy link

Hi, I am just thinking what is the need of deleting the files when update the configurations? is there any specific reason for that? By the way, is this issue resolved ?
Thanks,

@okraits
Copy link
Member Author

okraits commented Feb 7, 2020

Today a workmate of mine had the issue that an outdated backup of /etc/config/openwisp was present in /etc/openwisp/stored/etc/config/openwisp.

When he applied changes to /etc/config/openwisp and later removed those changes, the outdated backup was used to restore the original state.

Which led to the issue that openwisp-config used a wrong uuid/key to fetch the checksum from the controller. I have to look into that and fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement important Higher priority or release blocker
Projects
Archived in project
Status: Done
4 participants