From 547ae9e13e4733c926def8ad40e1b6a62b2bd26f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Fri, 1 Nov 2019 13:04:20 +0100 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=20SWU:=20Do=20not=20persist=20check?= =?UTF-8?q?=20providers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There really is no reason for that --- .../plugins/softwareupdate/__init__.py | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/octoprint/plugins/softwareupdate/__init__.py b/src/octoprint/plugins/softwareupdate/__init__.py index 597a53c2b..4c54fe2ae 100644 --- a/src/octoprint/plugins/softwareupdate/__init__.py +++ b/src/octoprint/plugins/softwareupdate/__init__.py @@ -118,9 +118,7 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin, self._configured_checks = self._settings.get(["checks"], merged=True) update_check_hooks = self._plugin_manager.get_hooks("octoprint.plugin.softwareupdate.check_config") - check_providers = self._settings.get(["check_providers"], merged=True) - if not isinstance(check_providers, dict): - check_providers = dict() + check_providers = dict() effective_configs = dict() @@ -168,9 +166,6 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin, for key, config in effective_configs.items(): self._configured_checks[key] = config - self._settings.set(["check_providers"], check_providers) - self._settings.save() - # we only want to process checks that came from plugins for # which the plugins are still installed and enabled config_checks = self._settings.get(["checks"]) @@ -279,7 +274,6 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin, }, }, "pip_command": None, - "check_providers": {}, "cache_ttl": 24 * 60, @@ -293,9 +287,6 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin, if "checks" in data: del data["checks"] - if "check_providers" in data: - del data["check_providers"] - checks = self._get_configured_checks() if "octoprint" in checks: data["octoprint_checkout_folder"] = self._get_octoprint_checkout_folder(checks=checks) @@ -394,7 +385,7 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin, self._version_cache_dirty = True def get_settings_version(self): - return 6 + return 7 def on_settings_migrate(self, target, current=None): @@ -479,6 +470,10 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin, dummy_defaults["plugins"][self._identifier]["checks"]["octoprint"] = None self._settings.set(["checks", "octoprint"], None, defaults=dummy_defaults) + if current is None or current < 7: + # remove check_providers again + self._settings.set(["check_providers"], None, defaults=dict(check_providers=dict())) + def _clean_settings_check(self, key, data, defaults, delete=None, save=True): if not data: # nothing to do