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

@@ -48,10 +48,9 @@ def _git(args, cwd, hide_stderr=False):
def get_latest(target, check):
if not "checkout_folder" in check:
raise ConfigurationInvalid("Update configuration for %s needs checkout_folder" % target)
checkout_folder = check["checkout_folder"]
checkout_folder = check.get("checkout_folder")
if checkout_folder is None:
raise ConfigurationInvalid("Update configuration for {} of type git_commit needs checkout_folder set and not None".format(target))
returncode, _ = _git(["fetch"], checkout_folder)
if returncode != 0:
@@ -85,4 +84,4 @@ def get_latest(target, check):
logger = logging.getLogger("octoprint.plugins.softwareupdate.version_checks.git_commit")
logger.debug("Target: %s, local: %s, remote: %s" % (target, local_commit, remote_commit))
return information, is_current
return information, is_current