Merge pull request #358 from ThomasWaldmann/fix-strip

do not strip interface_id_ipv(4|6) if empty/None, fixes #355
This commit is contained in:
TW 2018-09-30 22:14:54 +02:00 committed by GitHub
commit 04dcbc8662
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -396,11 +396,12 @@ def _on_update_success(host, fqdn, kind, ipaddr, secure, logger):
for rh in host.relatedhosts.all(): for rh in host.relatedhosts.all():
if rh.available: if rh.available:
if kind == 'ipv4': if kind == 'ipv4':
ifid = rh.interface_id_ipv4.strip() ifid = rh.interface_id_ipv4
netmask = host.netmask_ipv4 netmask = host.netmask_ipv4
else: # kind == 'ipv6': else: # kind == 'ipv6':
ifid = rh.interface_id_ipv6.strip() ifid = rh.interface_id_ipv6
netmask = host.netmask_ipv6 netmask = host.netmask_ipv6
ifid = ifid.strip() if ifid else ifid
_delete = not ifid # leave ifid empty if you don't want this rh record _delete = not ifid # leave ifid empty if you don't want this rh record
try: try:
rh_fqdn = FQDN(rh.name + '.' + fqdn.host, fqdn.domain) rh_fqdn = FQDN(rh.name + '.' + fqdn.host, fqdn.domain)