Queried PTR Records don't have an IP
Closed this issue · 2 comments
markeganfuller commented
Whilst creation of a PTR with an IP works:
objects.PtrRecord.create(connector=conn, ip='127.1.1.1', ptrdname="an.example.com", view="Internal")
When querying an PTR record there is no IP:
example = objects.PtrRecord.search(connector=conn, ptrdname="an.example.com")
example.ip
None
example.__dict__
{'connector': <infoblox_client.connector.Connector at 0x7fe494811fd0>,
'view': 'Internal',
'ipv4addr': None,
'ptrdname': 'an.example.com',
'extattrs': None,
'_ref': 'record:ptr/ZG5zLmJpbmRfcHRyJC4xLmFycGEuaW4tYWRkci4xOTIuMTM1LjIzMi4zMS5mcm9udGVuZDExLmFwb2NyaXRhLmhwYy5xbXVsLmFjLnVr:1.1.1.127.in-addr.arpa/Internal'
}
markeganfuller commented
Note, a workaround for this is to parse the IP out of the ref:
# Input example:
# record:ptr/ZG5zLmJpbmRfcHRyJC4xLmFycGEuaW4tYWRkci4xOTIuMTM1LjIzMi4zMS5mcm9udGVuZDExLmFwb2NyaXRhLmhwYy5xbXVsLmFjLnVr:1.1.1.127.in-addr.arpa/Internal
ip = example.ref
ip = ip.split(':')[2]
ip = ip.split('.in-addr')[0]
# Reverse to real IP not PTR
ip = ip.split('.')
ip.reverse()
ip = ".".join(ip)
# Output example
# 127.1.1.1
saiprasannasastry commented
Fixed in #238