Fix bug where if no plugins are installed, restore fails

* When no plugins are installed, backup does not create a
  plugin_list.json file.
* Restore then fails when it tries to read the missing file.
* Add check to ensure plugin_list.json exists before restoring
  from backup.
This commit is contained in:
Daniel Joyce committed 2019-02-06 21:06:19 -08:00
1 parent 0fda153d60
commit 0cf345f29b
1 file changed
+5 -2
+5 -2
View File
@@ -806,8 +806,11 @@ class BackupPlugin(octoprint.plugin.SettingsPlugin,
on_log_progress(u"Unpacked")
# install available plugins
with codecs.open(os.path.join(temp, "plugin_list.json"), "r") as f:
plugins = json.load(f)
plugins = []
plugin_list_file = os.path.join(temp, "plugin_list.json")
if os.path.exists(plugin_list_file):
with codecs.open(plugin_list_file, "r") as f:
plugins = json.load(f)
known_plugins = []
unknown_plugins = []