From a73e6f0bf80df5e18ebe6a4f0f44fca93248e4c1 Mon Sep 17 00:00:00 2001 From: Haw-minn Lu Date: Fri, 27 Apr 2018 14:51:55 -0700 Subject: [PATCH 1/4] Attach an info field to the service --- jupyterhub/services/service.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/jupyterhub/services/service.py b/jupyterhub/services/service.py index 6ec52b5d..49a78a41 100644 --- a/jupyterhub/services/service.py +++ b/jupyterhub/services/service.py @@ -175,6 +175,13 @@ class Service(LoggingConfigurable): If unspecified, an API token will be generated for managed services. """ ).tag(input=True) + + info = Dict( + help="""Provide a place to include miscellaneous information about the service, + provided through the configuration + """ + ).tag(input=True) + # Managed service API: spawner = Any() From 2cf00e6aaeb4c182a7e76439ec1a8669dc2568fe Mon Sep 17 00:00:00 2001 From: Haw-minn Lu Date: Thu, 24 May 2018 11:19:18 -0700 Subject: [PATCH 2/4] Add info field to service model --- jupyterhub/apihandlers/services.py | 1 + 1 file changed, 1 insertion(+) diff --git a/jupyterhub/apihandlers/services.py b/jupyterhub/apihandlers/services.py index 7c4bfb61..b0c5134e 100644 --- a/jupyterhub/apihandlers/services.py +++ b/jupyterhub/apihandlers/services.py @@ -23,6 +23,7 @@ def service_model(service): 'prefix': service.server.base_url if service.server else '', 'command': service.command, 'pid': service.proc.pid if service.proc else 0, + 'info': service.info } class ServiceListAPIHandler(APIHandler): From 319e8a106209a305e2ca16fbb855d572fd5fd7d0 Mon Sep 17 00:00:00 2001 From: Min RK Date: Mon, 28 May 2018 14:09:44 +0200 Subject: [PATCH 3/4] update service models in tests --- jupyterhub/tests/test_api.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/jupyterhub/tests/test_api.py b/jupyterhub/tests/test_api.py index 93258fa9..da5a1222 100644 --- a/jupyterhub/tests/test_api.py +++ b/jupyterhub/tests/test_api.py @@ -1500,6 +1500,7 @@ def test_get_services(app, mockservice_url): 'pid': mockservice.proc.pid, 'prefix': mockservice.server.base_url, 'url': mockservice.url, + 'info': {}, } } @@ -1526,6 +1527,7 @@ def test_get_service(app, mockservice_url): 'pid': mockservice.proc.pid, 'prefix': mockservice.server.base_url, 'url': mockservice.url, + 'info': {}, } r = yield api_request(app, 'services/%s' % mockservice.name, From 98d60402b510f1d4bca22517f3f8c60e52264492 Mon Sep 17 00:00:00 2001 From: Min RK Date: Mon, 28 May 2018 14:09:53 +0200 Subject: [PATCH 4/4] add service.info to rest api docs --- docs/rest-api.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/rest-api.yml b/docs/rest-api.yml index 4ea54864..310c9dde 100644 --- a/docs/rest-api.yml +++ b/docs/rest-api.yml @@ -689,6 +689,11 @@ definitions: description: The command used to start the service (if managed) items: type: string + info: + type: object + description: | + Additional information a deployment can attach to a service. + JupyterHub does not use this field. Token: type: object properties: