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

fix(get_nodetool_status): convert ipv6 to full format #7047

Merged
merged 1 commit into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion sdcm/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -4102,7 +4102,8 @@ def get_nodetool_status(self, verification_node=None): # pylint: disable=too-ma
if not match:
continue
node_info = match.groupdict()
node_ip = node_info.pop("ip")
# make sure we use ipv6 long format (some tools remove leading zeros)
node_ip = ipaddress.ip_address(node_info.pop("ip")).exploded
# NOTE: following replacement is needed for the K8S case where
# registered IP is different than the one used for network connections
if verification_node.is_kubernetes():
Expand Down
6 changes: 3 additions & 3 deletions unit_tests/test_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -523,11 +523,11 @@ def test_can_get_nodetool_status_ipv6(self): # pylint: disable=no-self-use
status = db_cluster.get_nodetool_status()

assert status == {'eu-north':
{'2a05:d016:cf8:de00:e07d:5832:c5c0:36a0':
{'2a05:d016:0cf8:de00:e07d:5832:c5c0:36a0':
{'state': 'UN', 'load': '774KB', 'tokens': '256', 'owns': '?',
'host_id': 'e2ed6943', 'rack': '1a'},
'2a05:d016:cf8:de00:339e:d0d:9446:1980': {'state': 'UN', 'load': '1.04MB', 'tokens': '256', 'owns': '?',
'host_id': 'd67e8502', 'rack': '1a'}}}
'2a05:d016:0cf8:de00:339e:0d0d:9446:1980': {'state': 'UN', 'load': '1.04MB', 'tokens': '256', 'owns': '?',
'host_id': 'd67e8502', 'rack': '1a'}}}

def test_can_get_nodetool_status_azure(self): # pylint: disable=no-self-use
resp = "\n".join(["Datacenter: eastus",
Expand Down