From: Frank Brehm Date: Fri, 12 Jan 2018 14:47:09 +0000 (+0100) Subject: Removing method is_local() from pp_lib/import_pdnsdata.py X-Git-Tag: 0.1.2~42 X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=9cb0007f537556bdc90432023a785fa45d942dd0;p=pixelpark%2Fadmin-tools.git Removing method is_local() from pp_lib/import_pdnsdata.py --- diff --git a/pp_lib/import_pdnsdata.py b/pp_lib/import_pdnsdata.py index e259daf..0ee28d1 100644 --- a/pp_lib/import_pdnsdata.py +++ b/pp_lib/import_pdnsdata.py @@ -31,7 +31,7 @@ from .common import pp, to_bool from .cfg_app import PpCfgAppError, PpConfigApplication -__version__ = '0.8.4' +__version__ = '0.8.5' LOG = logging.getLogger(__name__) # ============================================================================= @@ -666,66 +666,6 @@ class ImportPdnsdataApp(PpConfigApplication): LOG.debug("Commiting changes ...") self.tgt_connection.commit() - # ------------------------------------------------------------------------- - def is_local(self, domain): - - if self.verbose > 1: - LOG.debug("Checking, whether {!r} is a not public zone.".format(domain)) - - tld = domain.split('.')[-1] - if tld in ('intern', 'internal', 'local', 'localdomain', 'lokal'): - LOG.debug("Zone {!r} has a local TLD {!r}.".format(domain, tld)) - return True - - zone_base = domain.split('.')[0] - if zone_base in ('intern', 'internal', 'local', 'localdomain', 'lokal'): - LOG.debug("Zone {!r} has a local base {!r}.".format(domain, tld)) - return True - - if tld != 'arpa': - if self.verbose > 2: - LOG.debug("Zone {!r} has a public TLD {!r}.".format(domain, tld)) - return False - - if domain.endswith('.in-addr.arpa'): - tupels = [] - for tupel in reversed(domain.replace('.in-addr.arpa', '').split('.')): - tupels.append(tupel) - if self.verbose > 2: - LOG.debug("Got IPv4 tupels from zone {!r}: {}".format(domain, pp(tupels))) - bitmask = None - if len(tupels) == 1: - bitmask = 8 - tupels.append('0') - tupels.append('0') - tupels.append('0') - elif len(tupels) == 2: - tupels.append('0') - tupels.append('0') - bitmask = 16 - elif len(tupels) == 3: - bitmask = 24 - tupels.append('0') - else: - LOG.warn("Could not interprete reverse IPv4 zone {!r}.".format(domain)) - return False - net_address = '.'.join(tupels) + '/{}'.format(bitmask) - if self.verbose > 2: - LOG.debug("Got IPv4 network address of zone {!r}: {!r}.".format(domain, net_address)) - network = ipaddress.ip_network(net_address) - if network.is_global: - if self.verbose > 1: - LOG.debug("The network {!r} of zone {!r} is allocated for public networks.".format( - net_address, domain)) - return False - LOG.debug("The network {!r} of zone {!r} is allocated for local networks.".format( - net_address, domain)) - return True - - if self.verbose > 2: - LOG.debug("Zone {!r} seems to be a reverse zone for a public network.".format(domain)) - return False - # ------------------------------------------------------------------------- def import_cryptokeys(self):