diff options
author | Jonas Gunz <himself@jonasgunz.de> | 2022-09-21 17:03:43 +0200 |
---|---|---|
committer | Jonas Gunz <himself@jonasgunz.de> | 2022-09-21 17:03:43 +0200 |
commit | db5ef7c1b7f907d6856a5c8e16262725ce2b8a9b (patch) | |
tree | 91a5ba5f929b9a4e479bfb32abe2d1ef5dac91af | |
parent | ac903642cb6408c6675ebad4039735994ab8c24f (diff) | |
download | octodns-custom-provider-db5ef7c1b7f907d6856a5c8e16262725ce2b8a9b.tar.gz |
fix crash on empty hostnames
if no hostname is set on an IP Address, a None object
is returned. Added a check for that to just ignore those.
-rwxr-xr-x | octodns-custom-providers/source/phpipam.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/octodns-custom-providers/source/phpipam.py b/octodns-custom-providers/source/phpipam.py index 46fe8a3..529dbdf 100755 --- a/octodns-custom-providers/source/phpipam.py +++ b/octodns-custom-providers/source/phpipam.py @@ -45,6 +45,10 @@ class PhpipamSource(octodns.source.base.BaseSource): def _populate_reverse(self, zone, selected_addresses): for hostname in selected_addresses: + if type(hostname) is not str: + # If an IP has no hostname set + continue + data={ 'type':'PTR', 'ttl':self._default_ttl, @@ -70,7 +74,12 @@ class PhpipamSource(octodns.source.base.BaseSource): zone.add_record( new_record ) def _populate_forward(self, zone, selected_addresses): + print(selected_addresses) for _selected_address in selected_addresses: + if type(_selected_address) is not str: + # If an IP has no hostname set + continue + if not _selected_address.endswith(zone.name.strip('.')): continue |