-
Notifications
You must be signed in to change notification settings - Fork 10
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
Do not restore old backups when upgrade fails #110
Conversation
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.
Minor improvements
log.info "Restoring with script #{cmd} result: #{res}" | ||
backup_time = File.stat(path).ctime.to_i | ||
|
||
if boot_time < backup_time |
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'm not sure if this works on platforms without RTC (e.g. Raspberry Pi). If without RTC the boot time is always 0 then the backup would be always restored. We should check that.
src/modules/Update.rb
Outdated
@@ -850,6 +859,11 @@ def restore_backup | |||
|
|||
private | |||
|
|||
# @return [Integer] boot time found in /proc/stat | |||
def boot_time | |||
@boot_time ||= IO.read("/proc/stat")[/btime.*/].split.last.to_i |
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.
It would be nice to add a test for parsing the file, the added test mocks the method completely so it's skipped.
58f3339
to
107bb45
Compare
107bb45
to
2ae09b3
Compare
Closed in favor of #111 |
Related to https://bugzilla.suse.com/show_bug.cgi?id=1097297