Skip to content

Commit 7962798

Browse files
authored
Merge pull request #726 from jdkandersson/support-ipv6
#726 #### Description For machine charms, every now and then during testing libjuju will pick an IPv6 address to communicate with the machine. This results in problems with the part of the code changed because it just splits the endpoint to a host and port on the first `:` character which, for an IPv6 address, does not separate the host and port since an IPv6 address has many `:` characters in it. After applying this patch locally, libjuju is able to communicate with the machine again. *<Fixes: add support for ipv6 connections>* #### QA Steps *<Commands / tests / steps to run to verify that the change works: I ran tests for a charm that ocassionaly used ipv6 with these changes and they worked>* ``` tox -e py3 -- tests/unit/... ``` ``` tox -e integration -- tests/integration/... ``` All CI tests need to pass. *<Please note that most likely an additional test will be required by the reviewers for any change that's not a one liner to land.>* #### Notes & Discussion *<Additional notes for the reviewers if needed. Please delete section if not applicable.>*
2 parents c4c302e + b9ee2d1 commit 7962798

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

juju/client/connection.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,9 @@ def https_connection(self):
678678
679679
"""
680680
endpoint = self.endpoint
681-
host, remainder = endpoint.split(':', 1)
681+
# Support IPv6 by right splitting on : and removing [] around IP address for host
682+
host, remainder = endpoint.rsplit(':', 1)
683+
host = host.strip("[]")
682684
port = remainder
683685
if '/' in remainder:
684686
port, _ = remainder.split('/', 1)

0 commit comments

Comments
 (0)