Esempio n. 1
0
    def connection(url=None,
                   router=None,
                   timeout=10,
                   ssl_domain=None,
                   sasl=None):
        """Return a BlockingConnection suitable for connecting to a management node
        @param url: URL of the management node.
        @param router: If address does not contain a path, use the management node for this router ID.
            If not specified and address does not contain a path, use the default management node.
        """
        url = Url(url)  # Convert string to Url class.

        if url.path is None:
            if router:
                url.path = u'_topo/0/%s/$management' % router
            else:
                url.path = u'$management'

        if ssl_domain:
            sasl_enabled = True
        else:
            sasl_enabled = True if sasl else False

        # if sasl_mechanism is unicode, convert it to python string
        return BlockingConnection(
            url,
            timeout=timeout,
            ssl_domain=ssl_domain,
            sasl_enabled=sasl_enabled,
            allowed_mechs=str(sasl.mechs)
            if sasl and sasl.mechs != None else None,
            user=str(sasl.user) if sasl and sasl.user != None else None,
            password=str(sasl.password)
            if sasl and sasl.password != None else None)
Esempio n. 2
0
    def connection(url=None, router=None, timeout=10, ssl_domain=None, sasl=None):
        """Return a BlockingConnection suitable for connecting to a management node
        @param url: URL of the management node.
        @param router: If address does not contain a path, use the management node for this router ID.
            If not specified and address does not contain a path, use the default management node.
        """
        url = Url(url)          # Convert string to Url class.

        if url.path is None:
            if router:
                url.path = u'_topo/0/%s/$management' % router
            else:
                url.path = u'$management'

        if ssl_domain:
            sasl_enabled = True
        else:
            sasl_enabled = True if sasl else False

        # if sasl_mechanism is unicode, convert it to python string
        return BlockingConnection(url,
                                  timeout=timeout,
                                  ssl_domain=ssl_domain,
                                  sasl_enabled=sasl_enabled,
                                  allowed_mechs=str(sasl.mechs) if sasl and sasl.mechs != None else None,
                                  user=str(sasl.user) if sasl and sasl.user != None else None,
                                  password=str(sasl.password) if sasl and sasl.password != None else None)
Esempio n. 3
0
    def connection(url=None, router=None, timeout=10, ssl_domain=None):
        """Return a BlockingConnection suitable for connecting to a management node
        @param url: URL of the management node.
        @param router: If address does not contain a path, use the management node for this router ID.
            If not specified and address does not contain a path, use the default management node.
        """
        url = Url(url)  # Convert string to Url class.

        if url.path is None:
            if router:
                url.path = u'_topo/0/%s/$management' % router
            else:
                url.path = u'$management'

        return BlockingConnection(url, timeout=timeout, ssl_domain=ssl_domain)
Esempio n. 4
0
    def connection(url=None, router=None, timeout=10, ssl_domain=None):
        """Return a BlockingConnection suitable for connecting to a management node
        @param url: URL of the management node.
        @param router: If address does not contain a path, use the management node for this router ID.
            If not specified and address does not contain a path, use the default management node.
        """
        url = Url(url)          # Convert string to Url class.

        if url.path is None:
            if router:
                url.path = u'_topo/0/%s/$management' % router
            else:
                url.path = u'$management'

        return BlockingConnection(url, timeout=timeout, ssl_domain=ssl_domain)
Esempio n. 5
0
    def connection(url=None, timeout=10, ssl_domain=None, sasl=None):
        """
        Return a BlockingConnection for connection to a managemenet node
        """
        url = Url(url)

        url.path = u'$management'

        if ssl_domain:
            sasl_enabled = True
        else:
            sasl_enabled = True if sasl else False

        return BlockingConnection(url,
                                  timeout=timeout,
                                  ssl_domain=ssl_domain,
                                  sasl_enabled=sasl_enabled,
                                  allowed_mechs=str(sasl.mechs) if sasl and sasl.mechs != None else None,
                                  user=str(sasl.user) if sasl else None,
                                  password=str(sasl.password) if sasl else None)