コード例 #1
0
def check_cluster_versions(cluster,
                           required,
                           recommended=Version((3, 0, 4)),
                           label=None):
    try:
        with cluster.all() as client:
            results = client.info()
    except Exception as e:
        # Any connection issues should be caught here.
        raise InvalidConfiguration(unicode(e))

    versions = {}
    for id, info in results.value.items():
        host = cluster.hosts[id]
        # NOTE: This assumes there is no routing magic going on here, and
        # all requests to this host are being served by the same database.
        key = '{host}:{port}'.format(host=host.host, port=host.port)
        versions[key] = Version(map(int, info['redis_version'].split('.', 3)))

    check_versions(
        'Redis' if label is None else 'Redis (%s)' % (label, ),
        versions,
        required,
        recommended,
    )
コード例 #2
0
ファイル: redis.py プロジェクト: pasala91/test
def check_cluster_versions(cluster, required, recommended=None, label=None):
    try:
        with cluster.all() as client:
            results = client.info()
    except Exception as e:
        # Any connection issues should be caught here.
        raise InvalidConfiguration(str(e))

    versions = {}
    for id, info in results.value.items():
        host = cluster.hosts[id]
        # NOTE: This assumes there is no routing magic going on here, and
        # all requests to this host are being served by the same database.
        key = f"{host.host}:{host.port}"
        versions[key] = Version(map(int, info["redis_version"].split(".", 3)))

    check_versions("Redis" if label is None else f"Redis ({label})", versions,
                   required, recommended)
コード例 #3
0
ファイル: redis.py プロジェクト: justintung/sentry
    def validate(self):
        logger.info('Validating Redis version...')

        try:
            with self.cluster.all() as client:
                results = client.info()
        except Exception as e:
            # Any connection issues should be caught here.
            raise InvalidConfiguration(unicode(e))

        versions = {}
        for id, info in results.value.items():
            host = self.cluster.hosts[id]
            # NOTE: This assumes there is no routing magic going on here, and
            # all requests to this host are being served by the same database.
            key = '{host}:{port}'.format(host=host.host, port=host.port)
            versions[key] = Version(map(int, info['redis_version'].split('.', 3)))

        check_versions('Redis (TSDB)', versions, Version((2, 8, 9)), Version((3, 0, 4)))
コード例 #4
0
ファイル: redis.py プロジェクト: mightyguava/sentry
    def validate(self):
        logger.info('Validating Redis version...')

        try:
            with self.cluster.all() as client:
                results = client.info()
        except Exception as e:
            # Any connection issues should be caught here.
            raise InvalidConfiguration(unicode(e))

        versions = {}
        for id, info in results.value.items():
            host = self.cluster.hosts[id]
            # NOTE: This assumes there is no routing magic going on here, and
            # all requests to this host are being served by the same database.
            key = '{host}:{port}'.format(host=host.host, port=host.port)
            versions[key] = Version(
                map(int, info['redis_version'].split('.', 3)))

        check_versions('Redis (TSDB)', versions, Version((2, 8, 9)),
                       Version((3, 0, 4)))
コード例 #5
0
ファイル: redis.py プロジェクト: Kayle009/sentry
def check_cluster_versions(cluster, required, recommended=None, label=None):
    try:
        with cluster.all() as client:
            results = client.info()
    except Exception as e:
        # Any connection issues should be caught here.
        raise InvalidConfiguration(six.text_type(e))

    versions = {}
    for id, info in results.value.items():
        host = cluster.hosts[id]
        # NOTE: This assumes there is no routing magic going on here, and
        # all requests to this host are being served by the same database.
        key = u'{host}:{port}'.format(host=host.host, port=host.port)
        versions[key] = Version(map(int, info['redis_version'].split('.', 3)))

    check_versions(
        'Redis' if label is None else 'Redis (%s)' % (label, ),
        versions,
        required,
        recommended,
    )