From a431edd813898d78a67f44fa2a2720e191e45cee Mon Sep 17 00:00:00 2001 From: jabbera Date: Wed, 13 Sep 2023 07:15:57 -0400 Subject: [PATCH 1/4] use {base_url}/api for checking hub version --- jupyterhub/objects.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jupyterhub/objects.py b/jupyterhub/objects.py index 4fd215e8..4ab62501 100644 --- a/jupyterhub/objects.py +++ b/jupyterhub/objects.py @@ -3,7 +3,7 @@ # Distributed under the terms of the Modified BSD License. import socket import warnings -from urllib.parse import urlparse, urlunparse +from urllib.parse import urlparse, urlunparse, urljoin from traitlets import HasTraits, Instance, Integer, Unicode, default, observe, validate @@ -174,7 +174,7 @@ class Server(HasTraits): ) return wait_for_http_server( - self.url, timeout=timeout, ssl_context=ssl_context + urljoin(self.url, "api"), timeout=timeout, ssl_context=ssl_context ) else: return wait_for_server( From 6c872b6621a74c6c1907d3c5bebd7fd094a6606e Mon Sep 17 00:00:00 2001 From: jabbera Date: Wed, 13 Sep 2023 07:56:55 -0400 Subject: [PATCH 2/4] Code review update --- jupyterhub/objects.py | 4 ++-- jupyterhub/user.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/jupyterhub/objects.py b/jupyterhub/objects.py index 4ab62501..b8085e4a 100644 --- a/jupyterhub/objects.py +++ b/jupyterhub/objects.py @@ -166,7 +166,7 @@ class Server(HasTraits): name=self.__class__.__name__, url=self.url, bind=self.bind_url ) - def wait_up(self, timeout=10, http=False, ssl_context=None): + def wait_up(self, timeout=10, http=False, ssl_context=None, extra_path=""): """Wait for this server to come up""" if http: ssl_context = ssl_context or make_ssl_context( @@ -174,7 +174,7 @@ class Server(HasTraits): ) return wait_for_http_server( - urljoin(self.url, "api"), timeout=timeout, ssl_context=ssl_context + urljoin(self.url, extra_path), timeout=timeout, ssl_context=ssl_context ) else: return wait_for_server( diff --git a/jupyterhub/user.py b/jupyterhub/user.py index fe10b7bc..7d514732 100644 --- a/jupyterhub/user.py +++ b/jupyterhub/user.py @@ -901,7 +901,7 @@ class User: ssl_context = make_ssl_context(key, cert, cafile=ca) try: resp = await server.wait_up( - http=True, timeout=spawner.http_timeout, ssl_context=ssl_context + http=True, timeout=spawner.http_timeout, ssl_context=ssl_context, extra_path="api", ) except Exception as e: if isinstance(e, AnyTimeoutError): From 73aa219ebe5fdf7600f4fde38f6568c3aafb5706 Mon Sep 17 00:00:00 2001 From: jabbera Date: Wed, 13 Sep 2023 15:30:51 -0400 Subject: [PATCH 3/4] q --- jupyterhub/objects.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jupyterhub/objects.py b/jupyterhub/objects.py index b8085e4a..51742e71 100644 --- a/jupyterhub/objects.py +++ b/jupyterhub/objects.py @@ -3,7 +3,7 @@ # Distributed under the terms of the Modified BSD License. import socket import warnings -from urllib.parse import urlparse, urlunparse, urljoin +from urllib.parse import urlparse, urlunparse from traitlets import HasTraits, Instance, Integer, Unicode, default, observe, validate @@ -174,7 +174,7 @@ class Server(HasTraits): ) return wait_for_http_server( - urljoin(self.url, extra_path), timeout=timeout, ssl_context=ssl_context + url_path_join(self.url, extra_path), timeout=timeout, ssl_context=ssl_context ) else: return wait_for_server( From fd14ce2de3df0653574bf00949b6bd992f127774 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 14 Sep 2023 13:26:26 +0000 Subject: [PATCH 4/4] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- jupyterhub/objects.py | 4 +++- jupyterhub/user.py | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/jupyterhub/objects.py b/jupyterhub/objects.py index 51742e71..f497e904 100644 --- a/jupyterhub/objects.py +++ b/jupyterhub/objects.py @@ -174,7 +174,9 @@ class Server(HasTraits): ) return wait_for_http_server( - url_path_join(self.url, extra_path), timeout=timeout, ssl_context=ssl_context + url_path_join(self.url, extra_path), + timeout=timeout, + ssl_context=ssl_context, ) else: return wait_for_server( diff --git a/jupyterhub/user.py b/jupyterhub/user.py index 7d514732..e4a38f01 100644 --- a/jupyterhub/user.py +++ b/jupyterhub/user.py @@ -901,7 +901,10 @@ class User: ssl_context = make_ssl_context(key, cert, cafile=ca) try: resp = await server.wait_up( - http=True, timeout=spawner.http_timeout, ssl_context=ssl_context, extra_path="api", + http=True, + timeout=spawner.http_timeout, + ssl_context=ssl_context, + extra_path="api", ) except Exception as e: if isinstance(e, AnyTimeoutError):