On Thu, Mar 8, 2018 at 4:23 PM, Ian Pilcher <arequip...@gmail.com> wrote:
> (Because I certainly can't.) > > def _san_dnsname_ips(dnsname, dnsname_is_cname=False): >> """ >> Returns a set of IP addresses, managed by this IPa instance, >> that correspond to the DNS name (from the subjectAltName). >> >> """ >> fqdn = dnsutil.DNSName(dnsname).make_absolute() >> if fqdn.__len__() < 4: >> logger.debug("Skipping IPs for %s: hostname too short" % dnsname) >> return () >> zone = dnsutil.DNSName(resolver.zone_for_name(fqdn)) >> name = fqdn.relativize(zone) >> try: >> result = api.Command['dnsrecord_show'](zone, name)['result'] >> except errors.NotFound as nf: >> logger.debug("Skipping IPs for %s: %s" % (dnsname, nf)) >> return () >> ips = set() >> for ip in itertools.chain(result.get('arecord', ()), >> result.get('aaaarecord', ())): >> if _ip_rdns_ok(ip, fqdn): >> ips.add(ip) >> cnames = result.get('cnamerecord', ()) >> if cnames: >> if dnsname_is_cname: >> logger.debug("Skipping IPs for %s: chained CNAME" % dnsname) >> else: >> for cname in cnames: >> if not cname.endswith('.'): >> cname = u'%s.%s' % (cname, zone) >> ips.update(_san_dnsname_ips(cname, True) >> return ips >> > > 2.7 and 3.6 are both giving me: > > File "/tmp/test.py", line 32 > return ips > ^ > SyntaxError: invalid syntax > > I've checked for tabs and mismatched parentheses. > > Aargh! > > Check the line before the error. Seems there may be a ')' missing :) > -- > ======================================================================== > Ian Pilcher arequip...@gmail.com > -------- "I grew up before Mark Zuckerberg invented friendship" -------- > ======================================================================== > > -- > https://mail.python.org/mailman/listinfo/python-list > -- **** Listen to my FREE CD at http://www.mellowood.ca/music/cedars **** Bob van der Poel ** Wynndel, British Columbia, CANADA ** EMAIL: b...@mellowood.ca WWW: http://www.mellowood.ca -- https://mail.python.org/mailman/listinfo/python-list