Better resilience against broken software update configs

Fixes #1773
This commit is contained in:
Gina Häußge committed 2017-02-14 10:42:02 +01:00
1 parent b453897ea3
commit 5d97dc4b40
7 files changed
+46 -22

No files matched your search

@@ -8,7 +8,8 @@ __copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms
from ..exceptions import ConfigurationInvalid
def get_latest(target, check, full_data=False):
if not "python_checker" in check:
raise ConfigurationInvalid("Update configuration for %s of type commandline needs command defined" % target)
python_checker = check.get("python_checker")
if python_checker is None or not hasattr(python_checker, "get_latest"):
raise ConfigurationInvalid("Update configuration for {} of type python_checker needs python_checker defined and have an attribute \"get_latest\"".format(target))
return check["python_checker"].get_latest(target, check, full_data=full_data)