示例#1
0
    def __init__(self,
                 host,
                 username=None,
                 password=None,
                 port=MYSQL_FABRIC_PORT,
                 connect_attempts=_CNX_ATTEMPT_MAX,
                 connect_delay=_CNX_ATTEMPT_DELAY,
                 report_errors=False,
                 ssl_ca=None,
                 ssl_key=None,
                 ssl_cert=None,
                 user=None):
        """Initialize"""
        self._fabric_instances = {}
        self._fabric_uuid = None
        self._ttl = 1 * 60  # one minute by default
        self._version_token = None
        self._connect_attempts = connect_attempts
        self._connect_delay = connect_delay
        self._cache = FabricCache()
        self._group_balancers = {}
        self._init_host = host
        self._init_port = port
        self._ssl = _validate_ssl_args(ssl_ca, ssl_key, ssl_cert)
        self._report_errors = report_errors

        if user and username:
            raise ValueError("can not specify both user and username")
        self._username = user or username
        self._password = password
示例#2
0
    def reset_cache(self, group=None):
        """Reset cached information

        This method destroys all cached information.
        """
        if group:
            _LOGGER.debug(
                "Resetting cache for group '{group}'".format(group=group))
            self.get_group_servers(group, use_cache=False)
        else:
            _LOGGER.debug("Resetting cache")
            self._cache = FabricCache()