Skip to content

[enhancement]: Performance improvement - is_resolvable with IP based metadata URL #6557

@ozekidesu

Description

@ozekidesu

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions