Exemple #1
0
    def get(self):
        """
        Check if all listed indexes are healthy: they should be reachable,
        return valid JSON objects, and yield more than one result.
        """
        _, status = packs_service.fetch_pack_index(allow_empty=True)

        health = {
            "indexes": {
                "count": len(status),
                "valid": 0,
                "invalid": 0,
                "errors": {},
                "status": status,
            },
            "packs": {
                "count": 0,
            },
        }

        for index in status:
            if index['error']:
                error_count = health['indexes']['errors'].get(
                    index['error'], 0) + 1
                health['indexes']['invalid'] += 1
                health['indexes']['errors'][index['error']] = error_count
            else:
                health['indexes']['valid'] += 1
            health['packs']['count'] += index['packs']

        return health
Exemple #2
0
    def get(self):
        """
        Check if all listed indexes are healthy: they should be reachable,
        return valid JSON objects, and yield more than one result.
        """
        _, status = packs_service.fetch_pack_index(allow_empty=True)

        health = {
            "indexes": {
                "count": len(status),
                "valid": 0,
                "invalid": 0,
                "errors": {},
                "status": status,
            },
            "packs": {
                "count": 0,
            },
        }

        for index in status:
            if index['error']:
                error_count = health['indexes']['errors'].get(index['error'], 0) + 1
                health['indexes']['invalid'] += 1
                health['indexes']['errors'][index['error']] = error_count
            else:
                health['indexes']['valid'] += 1
            health['packs']['count'] += index['packs']

        return health
Exemple #3
0
    def get(self):
        """
        Check if all listed indexes are healthy: they should be reachable,
        return valid JSON objects, and yield more than one result.
        """
        proxy_config = _get_proxy_config()

        _, status = packs_service.fetch_pack_index(
            allow_empty=True, proxy_config=proxy_config
        )

        health = {
            "indexes": {
                "count": len(status),
                "valid": 0,
                "invalid": 0,
                "errors": {},
                "status": status,
            },
            "packs": {
                "count": 0,
            },
        }

        for index in status:
            if index["error"]:
                error_count = health["indexes"]["errors"].get(index["error"], 0) + 1
                health["indexes"]["invalid"] += 1
                health["indexes"]["errors"][index["error"]] = error_count
            else:
                health["indexes"]["valid"] += 1
            health["packs"]["count"] += index["packs"]

        return health
Exemple #4
0
    def get_all(self):
        proxy_config = _get_proxy_config()

        index, status = packs_service.fetch_pack_index(
            proxy_config=proxy_config)

        return {'status': status, 'index': index}
Exemple #5
0
    def get_all(self):
        proxy_config = _get_proxy_config()

        index, status = packs_service.fetch_pack_index(
            proxy_config=proxy_config)

        return {"status": status, "index": index}
Exemple #6
0
    def get_all(self):
        proxy_config = _get_proxy_config()

        index, status = packs_service.fetch_pack_index(proxy_config=proxy_config)

        return {
            'status': status,
            'index': index
        }