Example #1
0
    def on_client_connected(self, eventManager, event):
        try:
            try:
                hardware_info = self.scanProcessor.ask({FSEvents.COMMAND: FSScanProcessorCommand.GET_HARDWARE_INFO})
            except:
                hardware_info = "undefined"

            self._logger.debug("Upgrade available:"+str(upgrade_is_available()))

            message = {
                "client": event['client'],
                "state": self._state,
                "server_version": str(__version__),
                "firmware_version": str(hardware_info),
                "settings": self.settings.todict(self.settings),
                "upgrade": {
                    "available": upgrade_is_available(),
                    "version": str(get_latest_version_tag())
                }
            }

            eventManager.send_client_message(FSEvents.ON_CLIENT_INIT, message)
            self.scanProcessor.tell({FSEvents.COMMAND: FSScanProcessorCommand.NOTIFY_HARDWARE_STATE})

        except StandardError, e:
            self._logger.error(e)
Example #2
0
    def on_client_connected(self, eventManager, event):
        try:
            try:
                hardware_info = self.scanProcessor.ask({
                    FSEvents.COMMAND:
                    FSScanProcessorCommand.GET_HARDWARE_INFO
                })
            except:
                hardware_info = "undefined"

            upgrade_available, upgrade_version = upgrade_is_available(
                __version__)
            self._logger.debug("Upgrade available: " + str(upgrade_available) +
                               " " + upgrade_version)

            message = {
                "client": event['client'],
                "state": self._state,
                "server_version": 'v.' + __version__,
                "firmware_version": str(hardware_info),
                "settings": self.settings.todict(self.settings),
                "upgrade": {
                    "available": upgrade_available,
                    "version": upgrade_version
                }
            }

            eventManager.send_client_message(FSEvents.ON_CLIENT_INIT, message)
            self.scanProcessor.tell({
                FSEvents.COMMAND:
                FSScanProcessorCommand.NOTIFY_HARDWARE_STATE
            })

        except StandardError, e:
            self._logger.error(e)
Example #3
0
	def test_upgrade_is_available_upgrade_not_available(self, urlopen_mock):
		upgrade_available, upgrade_version = upgrade_is_available("0.3.1")
		self.assertFalse(upgrade_available)
		self.assertEqual(upgrade_version, "0.3.1")
	def test_upgrade_is_available_upgrade_not_available(self, urlopen_mock):
		upgrade_available, upgrade_version = upgrade_is_available("0.3.1")
		self.assertFalse(upgrade_available)
		self.assertEqual(upgrade_version, "0.3.1")