def __init__(self, arguments): self.host = arguments.get('host', self.DEFAULT_HOST) self.port = arguments.get('port', self.DEFAULT_PORT) self.timeout = int(arguments.get('timeout', self.DEFAULT_TIMEOUT)) self._client = etcd3gw.client(host=self.host, port=self.port, timeout=self.timeout)
def get_client(conf=None): global CLIENT conf = conf or CONF if not CLIENT: CLIENT = etcd3gw.client(host=conf.etcd.host, port=conf.etcd.port) return CLIENT
def get_client(conf=None): global CLIENT conf = conf or CONF if not CLIENT: if conf.etcd.protocol == "https": CLIENT = etcd3gw.client(host=conf.etcd.host, port=conf.etcd.port, protocol=conf.etcd.protocol, ca_cert=conf.etcd.ca_cert, cert_cert=conf.etcd.cert_file, cert_key=conf.etcd.cert_key) else: CLIENT = etcd3gw.client(host=conf.etcd.host, port=conf.etcd.port, protocol=conf.etcd.protocol) return CLIENT
def __init__(self, arguments): self.host = arguments.get('host', self.DEFAULT_HOST) self.port = arguments.get('port', self.DEFAULT_PORT) self.timeout = int(arguments.get('timeout', self.DEFAULT_TIMEOUT)) # module etcd3gw is only required when etcd3gw backend is used import etcd3gw self._client = etcd3gw.client(host=self.host, port=self.port, timeout=self.timeout)
def __init__(self, member_id, parsed_url, options): super(Etcd3Driver, self).__init__(member_id, parsed_url, options) host = parsed_url.hostname or self.DEFAULT_HOST port = parsed_url.port or self.DEFAULT_PORT options = utils.collapse(options) timeout = int(options.get('timeout', self.DEFAULT_TIMEOUT)) self.client = etcd3gw.client(host=host, port=port, timeout=timeout) self.lock_timeout = int(options.get('lock_timeout', timeout)) self.membership_timeout = int(options.get( 'membership_timeout', timeout)) self._acquired_locks = set()
def __init__(self, member_id, parsed_url, options): super(Etcd3Driver, self).__init__(member_id, parsed_url, options) protocol = 'https' if parsed_url.scheme.endswith('https') else 'http' host = parsed_url.hostname or self.DEFAULT_HOST port = parsed_url.port or self.DEFAULT_PORT options = utils.collapse(options) ca_cert = options.get('ca_cert') cert_key = options.get('cert_key') cert_cert = options.get('cert_cert') timeout = int(options.get('timeout', self.DEFAULT_TIMEOUT)) self.client = etcd3gw.client(host=host, port=port, protocol=protocol, ca_cert=ca_cert, cert_key=cert_key, cert_cert=cert_cert, timeout=timeout) self.lock_timeout = int(options.get('lock_timeout', timeout)) self.membership_timeout = int( options.get('membership_timeout', timeout)) self._acquired_locks = set()
def initialize(self, db_ip, db_port, **args): self.client = etcd.client(host=db_ip, port=db_port)
def initialize(self, callback): self.db_changes_callback = callback self.stop_event = threading.Event() ip, port = api_nb.get_db_ip_port() self.client = etcd3gw.client(host=ip, port=port)
def initialize(self): super(EtcdPublisherAgent, self).__init__() ip, port = api_nb.get_db_ip_port() self.client = etcd3gw.client(host=ip, port=port)
def initialize(self, db_ip, db_port, **args): #初始化db client(采用etcd进行存储) self.client = etcd.client(host=db_ip, port=db_port)
def initialize(self, callback): self.db_changes_callback = callback self.stop_event = threading.Event() self.client = etcd3gw.client(host=cfg.CONF.df.remote_db_ip, port=cfg.CONF.df.remote_db_port)
def initialize(self): super(EtcdPublisherAgent, self).__init__() self.client = etcd3gw.client(host=cfg.CONF.df.remote_db_ip, port=cfg.CONF.df.remote_db_port)