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, )
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)
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)))
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)))
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, )