Check the whole list for firmware-updates instead of just the first added container.

This commit is contained in:
Remco Burema 2018-10-11 14:56:07 +02:00
parent 487ef52c66
commit d8ed3d6074
2 changed files with 6 additions and 4 deletions

View file

@ -49,6 +49,7 @@ class FirmwareUpdateChecker(Extension):
self._download_url = None self._download_url = None
self._check_job = None self._check_job = None
self._name_cache = []
## Callback for the message that is spawned when there is a new version. ## Callback for the message that is spawned when there is a new version.
def _onActionTriggered(self, message, action): def _onActionTriggered(self, message, action):
@ -74,10 +75,10 @@ class FirmwareUpdateChecker(Extension):
# \param silent type(boolean) Suppresses messages other than "new version found" messages. # \param silent type(boolean) Suppresses messages other than "new version found" messages.
# This is used when checking for a new firmware version at startup. # This is used when checking for a new firmware version at startup.
def checkFirmwareVersion(self, container = None, silent = False): def checkFirmwareVersion(self, container = None, silent = False):
# Do not run multiple check jobs in parallel container_name = container.definition.getName()
if self._check_job is not None: if container_name in self._name_cache:
Logger.log("i", "A firmware update check is already running, do nothing.")
return return
self._name_cache.append(container_name)
self._check_job = FirmwareUpdateCheckerJob(container = container, silent = silent, self._check_job = FirmwareUpdateCheckerJob(container = container, silent = silent,
urls = self.VERSION_URLS_PER_MACHINE, urls = self.VERSION_URLS_PER_MACHINE,

View file

@ -34,6 +34,7 @@ def default_parse_version_response(response: str) -> Version:
## This job checks if there is an update available on the provided URL. ## This job checks if there is an update available on the provided URL.
class FirmwareUpdateCheckerJob(Job): class FirmwareUpdateCheckerJob(Job):
MACHINE_PER_NAME = \ MACHINE_PER_NAME = \
{ {
@ -155,7 +156,7 @@ class FirmwareUpdateCheckerJob(Job):
message.actionTriggered.connect(self._callback) message.actionTriggered.connect(self._callback)
message.show() message.show()
else: else:
Logger.log('i', "No machine with name {0} in list of firmware to check.".format(repr(machine_id))) Logger.log('i', "No machine with name {0} in list of firmware to check.".format(machine_name))
except Exception as e: except Exception as e:
Logger.log("w", "Failed to check for new version: %s", e) Logger.log("w", "Failed to check for new version: %s", e)