[DigitalOcean] Include IPv6 addresses in node public/private IPs - #2173
Open
Sanjays2402 wants to merge 2 commits into
Open
[DigitalOcean] Include IPv6 addresses in node public/private IPs#2173Sanjays2402 wants to merge 2 commits into
Sanjays2402 wants to merge 2 commits into
Conversation
The DigitalOcean v2 driver's _to_node() only iterated the "v4" networks list, so a droplet's public IPv6 address was never reported in Node.public_ips. Each match also reassigned the list rather than appending, so only the last address of a given type survived. Iterate both the "v4" and "v6" network lists and append, keeping every reported address. Adds a regression test covering a droplet with both an IPv4 and an IPv6 public address, and updates test_list_nodes_success, whose existing fixture already contains a public IPv6 address that was being dropped. Closes apache#1738
There was a problem hiding this comment.
Pull request overview
This PR fixes DigitalOcean v2 node network parsing so Node.public_ips / Node.private_ips include IPv6 addresses and preserve multiple addresses instead of overwriting earlier entries.
Changes:
- Update
DigitalOcean_v2_NodeDriver._to_node()to iterate bothnetworks["v4"]andnetworks["v6"]and append IPs. - Update the DigitalOcean v2 compute tests to assert IPv6 appears in
public_ips, and add a targeted_to_node()unit test. - Add a changelog entry documenting the behavior fix.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
libcloud/compute/drivers/digitalocean.py |
Include IPv6 networks in IP extraction and append IPs to avoid overwriting. |
libcloud/test/compute/test_digitalocean_v2.py |
Extend assertions to cover IPv6 in public_ips and add a unit test for _to_node(). |
CHANGES.rst |
Document the DigitalOcean IPv6/public+private IP reporting fix. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## trunk #2173 +/- ##
==========================================
+ Coverage 83.39% 83.40% +0.01%
==========================================
Files 351 351
Lines 81519 81524 +5
Branches 8747 8747
==========================================
+ Hits 67982 67992 +10
+ Misses 10744 10742 -2
+ Partials 2793 2790 -3
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[DigitalOcean] Include IPv6 addresses in node public/private IPs
Description
Closes #1738
DigitalOcean_v2_NodeDriver._to_node()only iterated thev4networks list, so a droplet's public IPv6 address was never reported inNode.public_ips. Each match also reassigned the list (public_ips = [...]) instead of appending, so only the last address of a given type survived. Both lists are now iterated and addresses appended.This matches the patch proposed in the issue. Note that the existing
list_nodesfixture already contains a public IPv6 address (2604:a880:4:1d0::142:9000) that was being silently dropped, sotest_list_nodes_successwas updated to assert it.Status
done, ready for review
Checklist (tick everything that applies)