def has_connectivity_on(self, address): try: log_verbose("Checking if server '%s' is accessible on " "address '%s'" % (self.id, address)) mongo_utils.mongo_client(address) return True except Exception, e: log_exception(e) log_verbose("Check failed for server '%s' is accessible on " "address '%s': %s" % (self.id, address, e)) return False
def new_mongo_client(self, **kwargs): address = self.get_connection_address() kwargs = kwargs or {} if self.connection_timeout_ms: kwargs["connectTimeoutMS"] = self.connection_timeout_ms return mongo_utils.mongo_client(address, **kwargs)