-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[VIRTS-1970] Move files aside on --fresh instead of deleting them #2101
Conversation
This is to make it possible to restore server state after an accidental --fresh start.
Codecov Report
@@ Coverage Diff @@
## master #2101 +/- ##
==========================================
- Coverage 65.68% 65.63% -0.06%
==========================================
Files 65 65
Lines 4890 4906 +16
==========================================
+ Hits 3212 3220 +8
- Misses 1678 1686 +8
Continue to review full report at Codecov.
|
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.
Nit: Consider using single quotes rather than double.
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.
not blockers but I think the updated message and zipping the files would be helpful
…e/caldera into bworrell/virts-1970/fresh-snapshots
I'll need to make another fieldmanual PR to update the documentation explaining the |
Description
Depends on: mitre/fieldmanual#73
When running
server.py --fresh
, we currently delete the files under thedata
directory to reset the server state. This changes the behavior to back up the files before deleting them (creating a timestamped, gzipped tarball containing the files that are about to be deleted)Note
Every time you run the server with
--fresh
you will generate a new backup tarball. The backup filenames include a timestamp so you can always fine the most recent one.Examples of directory structure pre/post
--fresh
(I didn't runtree -a
so .gitkeep files don't appear, but they are there!):Before:
After running w/
--fresh
Contents of the tarball
Why?
Sometimes users run the server with
--fresh
on accident and end up accidentally deleting all their progress/work. This allows users to restore their files in this case. Note that the restore procedure is not actually documented anywhere at this time. We may choose to provide some sort of--restore-previous-state
flag that could load the files out of thebackup
directory.Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Still working on this. But I've run the server with
--fresh
and observed that the tarball is created as expected. Note that this does not remove the.gitkeep
file under eachdata/*
subdirectory.I also ran the following command to restore a backup state:
Checklist: