Ejemplo n.º 1
0
 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)
Ejemplo n.º 2
0
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
Ejemplo n.º 3
0
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
Ejemplo n.º 4
0
 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)
Ejemplo n.º 5
0
Archivo: etcd3gw.py Proyecto: Kami/tooz
 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()
Ejemplo n.º 6
0
 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()
Ejemplo n.º 7
0
 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()
Ejemplo n.º 8
0
 def initialize(self, db_ip, db_port, **args):
     self.client = etcd.client(host=db_ip, port=db_port)
Ejemplo n.º 9
0
 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)
Ejemplo n.º 10
0
 def initialize(self):
     super(EtcdPublisherAgent, self).__init__()
     ip, port = api_nb.get_db_ip_port()
     self.client = etcd3gw.client(host=ip, port=port)
Ejemplo n.º 11
0
 def initialize(self, db_ip, db_port, **args):
     #初始化db client(采用etcd进行存储)
     self.client = etcd.client(host=db_ip, port=db_port)
Ejemplo n.º 12
0
 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)
Ejemplo n.º 13
0
 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)