Skip to content

Commit

Permalink
Merge pull request #499 from minrk/rm-deprecated
Browse files Browse the repository at this point in the history
Remove deprecated, broken hub_ip_connect
  • Loading branch information
minrk authored Nov 14, 2023
2 parents b755dc2 + 876dc8e commit 99de826
Showing 1 changed file with 3 additions and 32 deletions.
35 changes: 3 additions & 32 deletions dockerspawner/dockerspawner.py
Original file line number Diff line number Diff line change
Expand Up @@ -654,22 +654,13 @@ def _legacy_escape(text):

hub_ip_connect = Unicode(
config=True,
help=dedent(
"""
If set, DockerSpawner will configure the containers to use
the specified IP to connect the hub api. This is useful
when the hub_api is bound to listen on all ports or is
running inside of a container.
"""
),
help="DEPRECATED since JupyterHub 0.8. Use c.JupyterHub.hub_connect_ip.",
)

@observe("hub_ip_connect")
def _ip_connect_changed(self, change):
warnings.warn(
"DockerSpawner.hub_ip_connect is no longer needed with JupyterHub 0.8."
" Use JupyterHub.hub_connect_ip instead.",
DeprecationWarning,
self.log.warning(
f"Ignoring DockerSpawner.hub_ip_connect={change.new!r}, which has ben deprected since JupyterHub 0.8. Use c.JupyterHub.hub_connect_ip instead."
)

use_internal_ip = Bool(
Expand Down Expand Up @@ -933,30 +924,10 @@ def get_state(self):
)
return state

def _public_hub_api_url(self):
proto, path = self.hub.api_url.split("://", 1)
ip, rest = path.split(":", 1)
return "{proto}://{ip}:{rest}".format(
proto=proto, ip=self.hub_ip_connect, rest=rest
)

def _env_keep_default(self):
"""Don't inherit any env from the parent process"""
return []

def get_args(self):
args = super().get_args()
if self.hub_ip_connect:
# JupyterHub 0.7 specifies --hub-api-url
# on the command-line, which is hard to update
for idx, arg in enumerate(list(args)):
if arg.startswith("--hub-api-url="):
args.pop(idx)
break

args.append("--hub-api-url=%s" % self._public_hub_api_url())
return args

def get_env(self):
env = super().get_env()
env['JUPYTER_IMAGE_SPEC'] = self.image
Expand Down

0 comments on commit 99de826

Please sign in to comment.