do not strip interface_id_ipv(4|6) if empty/None, fixes #355

This commit is contained in:
Thomas Waldmann 2018-09-28 23:17:30 +02:00
parent 917dacfceb
commit 3caf2508f7

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)