Skip to content

Commit

Permalink
fix: Add check if the data source supports IPv6 when perform dhcp
Browse files Browse the repository at this point in the history
  • Loading branch information
jinkangkang.jkk committed Oct 15, 2024
1 parent 0c24aa2 commit 88c3ec3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cloudinit/sources/DataSourceEc2.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import uuid
from contextlib import suppress
from typing import Dict, List
from urllib.parse import urlparse

from cloudinit import dmi, net, sources
from cloudinit import url_helper as uhelp
Expand Down Expand Up @@ -158,7 +159,7 @@ def _get_data(self):
self.distro,
self.distro.fallback_interface,
ipv4=True,
ipv6=True,
ipv6=any([net.is_ipv6_address(urlparse(url).netloc.strip("[]")) for url in self.metadata_urls]),
) as netw:
self._crawled_metadata = self.crawl_metadata()
LOG.debug(
Expand Down

0 comments on commit 88c3ec3

Please sign in to comment.