aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jonas Gunz <himself@jonasgunz.de> 2022-09-21 17:03:43 +0200
committerGravatar Jonas Gunz <himself@jonasgunz.de> 2022-09-21 17:03:43 +0200
commitdb5ef7c1b7f907d6856a5c8e16262725ce2b8a9b (patch)
tree91a5ba5f929b9a4e479bfb32abe2d1ef5dac91af
parentac903642cb6408c6675ebad4039735994ab8c24f (diff)
downloadoctodns-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-xoctodns-custom-providers/source/phpipam.py9
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