From 2712dc42267a6150423d705f85170dc3d9986213 Mon Sep 17 00:00:00 2001 From: blair drummond Date: Fri, 5 Feb 2021 10:13:25 -0500 Subject: [PATCH] change authenticate_prometheus default --- notebook/notebookapp.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/notebook/notebookapp.py b/notebook/notebookapp.py index de1b0f6a19..fb753e88bb 100755 --- a/notebook/notebookapp.py +++ b/notebook/notebookapp.py @@ -1584,6 +1584,21 @@ def _update_server_extensions(self, change): """ ).tag(config=True) + @default('authenticate_prometheus') + def _default_authenticate_prometheus(self): + """ Authenticate Prometheus by default, unless auth is disabled. """ + auth = bool(self.password) or bool(self.token) + if auth is False: + self.log.info(_("Authentication of /metrics is OFF, since other authentication is disabled.")) + return auth + + @observe('authenticate_prometheus') + def _update_authenticate_prometheus(self, change): + newauth = change['new'] + if self.authenticate_prometheus is True and newauth is False: + self.log.info(_("Authentication of /metrics is being turned OFF.")) + self.authenticate_prometheus = newauth + # Since use of terminals is also a function of whether the terminado package is # available, this variable holds the "final indication" of whether terminal functionality # should be considered (particularly during shutdown/cleanup). It is enabled only