Merge pull request #2993 from hgross/fix/restore-on-docker-volumes

Fix #2992 (restore mechanism on docker volumes)
This commit is contained in:
Gina Häußge authored and GitHub committed 2019-01-11 14:54:45 +01:00
commit 4728a1a5a9
2 files changed
+5 -4

No files matched your search

+1
View File
@@ -94,6 +94,7 @@ date of first contribution):
* [Gaston Dombiak](https://github.com/gdombiak)
* [Brad Fisher](https://github.com/bradcfisher)
* [Aldo Hoeben](https://github.com/fieldofview)
* [Henning Groß](https://github.com/hgross)
* [Jubaleth](https://github.com/jubaleth)
OctoPrint started off as a fork of [Cura](https://github.com/daid/Cura) by
+4 -4
View File
@@ -684,7 +684,7 @@ class BackupPlugin(octoprint.plugin.SettingsPlugin,
if len(plugins):
zip.writestr("plugin_list.json", json.dumps(plugins))
os.rename(temporary_path, final_path)
shutil.move(temporary_path, final_path)
if callable(on_backup_done):
on_backup_done(name, final_path, exclude)
@@ -834,18 +834,18 @@ class BackupPlugin(octoprint.plugin.SettingsPlugin,
if callable(on_log_progress):
on_log_progress(u"Renaming {} to {}...".format(basedir, basedir_backup))
os.rename(basedir, basedir_backup)
shutil.move(basedir, basedir_backup)
try:
if callable(on_log_progress):
on_log_progress(u"Moving {} to {}...".format(basedir_extracted, basedir))
os.rename(basedir_extracted, basedir)
shutil.move(basedir_extracted, basedir)
except:
if callable(on_log_error):
on_log_error(u"Error while restoring config data", exc_info=sys.exc_info())
on_log_error(u"Rolling back old config data")
os.rename(basedir_backup, basedir)
shutil.move(basedir_backup, basedir)
if callable(on_restore_failed):
on_restore_failed(path)