-
Notifications
You must be signed in to change notification settings - Fork 137
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
Import/export settings (or bootstrap with default config) #955
Conversation
It took me longer than expected (last week was busy) but I made some progress. There is now a rudimentary config backup/restore functionality. I plan to support backup/restore of multiple profiles at once. @m3nu It would be very welcome if you could take a look and tell me if I am going into the right direction. |
Good stuff! Basic flow works. Great progress. Some thoughts (may overlap with your todo):
|
Hi @m3nu, beside the bootstrapping I think I ticked off all items on your list. Could you take another look? |
Perfect! Please allow me 1-2 days for testing and review. Then we can merge in time for the next 0.7.6 release. |
Great, I still need to fix/implement tests and the bootstrap feature though. I try to get this done within the next two days also. |
Hi @m3nu, I am almost done. I only need to clarify two things:
Edit: I will also mark this PR as ready for review because I think it is a functional unit. We could deal with documentation and bootstrapping in another PR and long running PRs usually do not end well. |
I'd say event logs aren't too important to keep around. Personally I never looked at them. We don't copy the log files either. Overwriting the profile and deleting the import file after sounds good. Since you want to do it non-interactive, you probably do not want a confirmation? It's also very deliberate to place such a bootstrap file. It won't happen by accident. |
Ok I resolved the outstanding issues. Profiles located at |
Perfect. Will look at it first thing tomorrow. I can do the docs. It’s a separate repo. Will also help me understand it from a user view. |
I messed up the tests with my last commit. They should pass now. |
src/vorta/borg/create.py
Outdated
@@ -51,13 +51,13 @@ def finished_event(self, result): | |||
|
|||
@classmethod | |||
def pre_post_backup_cmd(cls, params, cmd='pre_backup_cmd', returncode=0): | |||
cmd = getattr(params['profile'], cmd) | |||
cmd = getattr(params['profile_export'], cmd) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Search & Replace gone overboard here? Also affects a few other files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh how embarassing. Fixing it ASAP.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries. Can happen in the heat of battle.
src/vorta/views/main_window.py
Outdated
@@ -163,6 +182,60 @@ def profile_add_action(self): | |||
window.profile_changed.connect(self.profile_add_edit_result) | |||
window.rejected.connect(lambda: self.profileSelector.setCurrentIndex(self.profileSelector.currentIndex())) | |||
|
|||
def profile_export_action(self): | |||
window = ExportWindow(profile=self.current_profile) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest to use self.profile()
here as reference to the profile saved in the DB. Else updated settings won't be saved during export.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For that to work in need to add BackupProfileMixin to the main window. Shall I do it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added it now and it works. But I can change it if you had something different in mind.
Good stuff. 👍 Just noticed a few minor things. This will be ready to merge soon. I was a bit skeptical on the Import/Export buttons, but after using it, it makes sense. |
The change was more extensive than anticipated. I did not want to delete the "Default" profile when bootstrapping but prevent its creation instead. Else I fear there could be some unexpected side effects.
Beside the tests I also checked the behavior manually. When starting Vorta for the first time and bootstrapping from .vorta-init.json we only have the imported profile. When starting Vorta not the first time and we bootstrap from file preexisting profiles are preserved (if the imported profile name != existing profile name of course). I can now edit the PR description so the commit message actually describes the feature. Or do you want to do this? |
Another option is to only do bootstrapping, if no profile exists yet? Since overwriting things may be surprising for users, if you place the file via MDM. Reasons for moving stuff around are clear. I'd prefer to have less stuff in MainWindow, but that may make it more complicated. Will see. |
At least in my use-case it causes more confusion: I work with a self-service app, and I plan to add an item there like "Setup Backup" or something. It should install Vorta and place the bootstrap file. The item then changes to "Update Backup" and when clicked it re-places the bootstrap file. This is for botched configurations or when the backup server's port changes or similar. |
I don't have a better solution either. Overwriting it is OK, since placing this file is very intentional. Will continue to understand the changes and merge it now. |
Re-arranged a few things to isolate this feature more. Just so it's all in one place, if someone needs to make changes. For the test, I just removed the pytest-mark thing in Then for the hardcoded Hope you agree with my changes. It's really just how I like to structure things for the future. There was nothing wrong before. Maybe I even broke something, so please check that it all works as expected still. After that, let's merge this and do a release to get some feedback (Users don't usually test the |
The changes are fine to me. And it totally makes sense that you keep an eye on the overall architecture. I wouldn't do it differently with my own projects :-) I checked out your changes and tested the bootstrapping. Still seems to work. On bootstrap the user is not notified about the import any more. Is that on purpose? |
Not really. Maybe I cleaned up too much. Let me put it back. |
…) since this is a class method
I put back the notification and added a log as well. |
Seems we're done here. Next up are some docs on how to use the bootstrapped import. Not very complicated though. |
That is great news! Can't wait for your next release 🎉 |
Docs: borgbase/vorta.borgbase.com#24 Please let me know if you want to add anything. This will be below Usage |
Release tomorrow morning or so. We have enough features by now. |
Release done, @phihos : https://github.com/borgbase/vorta/releases/tag/v0.7.6 |
Just discovered vorta and I noticed, that when exporting my profile, that only the currently selected repository is exported into the json file. Is this working as intended? Is there a way to export the complete profile/configuration to include all repositories? |
Currently only the current profile is exported along with the general settings. If you feel like vorta should show a different behaviour, which is very legitimate, please open a new issue. |
Continuing the work of #954.
Left to do: