Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
add cli initiated config backup #1382
In cases where Rockstor's Web-UI has failed catastrophically a cli initiated config-backup could play a valuable part in disaster recovery scenarios as it would then be possible to archive the current config and retrieve the resulting file via scp and then execute a pool / share import and config restore procedure.
The file could be stored identically to the current Web-UI backups and in the same format, ie zipped json in /opt/rockstor/static/config-backups. Obviously some cli feedback indicating the success or otherwise of the command should also be incorporated. And given the use of the same location and format, if the cli command fails at least the user would be led to finding previous config backups if they exist.
A related function here could be an automated config-backup just prior to every Rockstor update procedure.
referenced this issue
Jul 8, 2016
I'm interested to work on this feature. As I don't have much experience with python (coming from ruby/java world), I need some pointers where to start.
I see that the config backup functionality is implemented in ConfigBackupListView#post.
@daniel-illi great to hear you like to contribute! python should be super easy coming from java. You should read up on console scripts in python. and take a look at setup.py. You can also look at src/rockstor/scripts directory for various scripts that become binaries via console scripts mechanism.
You are right about extracting the view logic out into it's own callable. I haven't looked at the code recently, but sounds about right. I wouldn't call it "service" though. It can just be a function that's imported in your script as well as the view. This code can go under system/
Feel free to be bold with your changes.