-
Notifications
You must be signed in to change notification settings - Fork 58
Open
Description
Hi,
Found an issue where we can't find a host if it has AAAA record set.
I updated infoblox.py to search extattrs by ip aswell
def get_ip_extattrs(self, ip_v4, attributes=None):
""" Implements IBA REST API call to retrieve host extensible attributes
Returns hash table of attributes with attribute name as a hash key
:param ipv4: ipv4
:param attributes: array of extensible attribute names (optional)
"""
rest_url = 'https://' + self.iba_host + '/wapi/v' + self.iba_wapi_version + '/ipv4address?ip_address=' + ip_v4 + '&_return_fields=extattrs'
try:
r = requests.get(url=rest_url, auth=(self.iba_user, self.iba_password), verify=self.iba_verify_ssl)
r_json = r.json()
if r.status_code == 200:
if len(r_json) > 0:
extattrs = {}
if attributes:
for attribute in attributes:
if attribute in r_json[0]['extattrs']:
extattrs[attribute] = r_json[0]['extattrs'][attribute]['value']
else:
raise InfobloxNotFoundException("No requested attribute found: " + attribute)
else:
for attribute in r_json[0]['extattrs'].keys():
extattrs[attribute] = r_json[0]['extattrs'][attribute]['value']
return extattrs
else:
raise InfobloxNotFoundException("No requested host found: " + fqdn)
else:
if 'text' in r_json:
raise InfobloxNotFoundException(r_json['text'])
else:
r.raise_for_status()
except ValueError:
raise Exception(r)
except Exception:
raise
Metadata
Metadata
Assignees
Labels
No labels