cloud-init
cloud-init copied to clipboard
[enhancement]: Performance improvement - is_resolvable with IP based metadata URL
Enhancement
When using metadata URLs like http://169.254.169.254 OR http://[fd00:ec2::254] dns resolution is unnecessary.
Moving the following codeblock in cloudinit/util.py to just before line 1310 will allow an affirmative ip detection to bypass the dns resolution step
# ip addresses need no resolution
try:
with suppress(ValueError):
if net.is_ip_address(parsed_url.netloc.strip("[]")):
return True
except (ValueError, AttributeError):
pass