Пример #1
0
    def run(self):
        last_check = config.get('update-checks', {}).get(self.component, {})
        if last_check.get('timestamp',
                          0) < time.time() - 86400:  # minus one day
            logger.debug("Haven't looked for updates lately; checking...")
            try:
                latest = sdk_manager.request(
                    "/v1/files/{}/latest?channel={}".format(
                        self.component, sdk_manager.get_channel()))
            except requests.RequestException as e:
                logger.info("Update check failed: %s", e)
                return
            if not 200 <= latest.status_code < 400:
                logger.info("Update check failed: %s (%s)", latest.status_code,
                            latest.reason)
                return

            result = latest.json()
            with config.lock:
                config.setdefault('update-checks', {})[self.component] = {
                    'timestamp': time.time(),
                    'version': result['version'],
                    'release_notes': result.get('release_notes', None)
                }
            self._check_version(result['version'],
                                result.get('release_notes', None))
        else:
            self._check_version(last_check['version'],
                                last_check.get('release_notes', None))
Пример #2
0
    def run(self):
        last_check = config.get('update-checks', {}).get(self.component, {})
        if last_check.get('timestamp', 0) < time.time() - 86400:  # minus one day
            logger.debug("Haven't looked for updates lately; checking...")
            latest = sdk_manager.request("/v1/files/{}/latest?channel={}"
                                  .format(self.component, sdk_manager.get_channel()))
            if not 200 <= latest.status_code < 400:
                logger.info("Update check failed: %s (%s)", latest.status_code, latest.reason)
                return

            result = latest.json()
            with config.lock:
                config.setdefault('update-checks', {})[self.component] = {
                    'timestamp': time.time(),
                    'version': result['version'],
                }
            self._check_version(result['version'])
        else:
            self._check_version(last_check['version'])
Пример #3
0
 def get_channel(cls):
     return config.get('sdk-channel', '')
Пример #4
0
 def get_channel(cls):
     return config.get('sdk-channel', '')