Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AAAA Records #25

Open
gekkyy opened this issue Apr 16, 2018 · 0 comments
Open

AAAA Records #25

gekkyy opened this issue Apr 16, 2018 · 0 comments

Comments

@gekkyy
Copy link

gekkyy commented Apr 16, 2018

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant