mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-16 06:22:59 +00:00
avoid raising on 404 deleting proxy route
deleting a route that doesn't exist should only warn, not error
This commit is contained in:
@@ -24,7 +24,7 @@ from subprocess import Popen
|
|||||||
from urllib.parse import quote
|
from urllib.parse import quote
|
||||||
|
|
||||||
from tornado import gen
|
from tornado import gen
|
||||||
from tornado.httpclient import AsyncHTTPClient, HTTPRequest
|
from tornado.httpclient import AsyncHTTPClient, HTTPRequest, HTTPError
|
||||||
from tornado.ioloop import PeriodicCallback
|
from tornado.ioloop import PeriodicCallback
|
||||||
|
|
||||||
|
|
||||||
@@ -576,7 +576,16 @@ class ConfigurableHTTPProxy(Proxy):
|
|||||||
|
|
||||||
def delete_route(self, routespec):
|
def delete_route(self, routespec):
|
||||||
path = self._routespec_to_chp_path(routespec)
|
path = self._routespec_to_chp_path(routespec)
|
||||||
return self.api_request(path, method='DELETE')
|
try:
|
||||||
|
return self.api_request(path, method='DELETE')
|
||||||
|
except HTTPError as e:
|
||||||
|
if e.status_code == 404:
|
||||||
|
# Warn about 404s because something might be wrong
|
||||||
|
# but don't raise because the route is gone,
|
||||||
|
# which is the goal.
|
||||||
|
self.log.warning("Route %s already deleted", routespec)
|
||||||
|
else:
|
||||||
|
raise
|
||||||
|
|
||||||
def _reformat_routespec(self, routespec, chp_data):
|
def _reformat_routespec(self, routespec, chp_data):
|
||||||
"""Reformat CHP data format to JupyterHub's proxy API."""
|
"""Reformat CHP data format to JupyterHub's proxy API."""
|
||||||
|
Reference in New Issue
Block a user