Ejemplo n.º 1
0
    def _resolve_cell_from_dns(self, cellname):
        """Resolve Zookeeper connection string from DNS."""
        if not self.dns_domain:
            _LOGGER.warn('DNS domain is not set.')
            zkurl_rec = dnsutils.txt('zk.%s' % (cellname))
        else:
            zkurl_rec = dnsutils.txt('zk.%s.%s' % (cellname, self.dns_domain))

        if zkurl_rec:
            self.cell = cellname
            self.zk.url = zkurl_rec[0]

        return bool(self.zk.url)
Ejemplo n.º 2
0
def _zk_url(ctx):
    """Resolve Zookeeper connection string from DNS."""
    if not ctx.dns_domain:
        _LOGGER.warning('DNS domain is not set.')
        zkurl_rec = dnsutils.txt('zk.%s' % (ctx.cell), ctx.dns_server)
    else:
        zkurl_rec = dnsutils.txt('zk.%s.%s' % (ctx.cell, ctx.dns_domain),
                                 ctx.dns_server)

    if zkurl_rec:
        return zkurl_rec[0]
    else:
        return None
Ejemplo n.º 3
0
def _tktfwd_spn(dns_domain):
    """Return tktfwd SPN for given dns domain."""
    tktfwd_rec = dnsutils.txt('tktfwd.%s' % (dns_domain),
                              context.GLOBAL.dns_server)

    if tktfwd_rec:
        return tktfwd_rec[0]
    else:
        return None