Merge pull request #1852 from summerswallow-whi/service-info

Attach an info field to the service
This commit is contained in:
Min RK
2018-05-28 14:57:10 +02:00
committed by GitHub
4 changed files with 15 additions and 0 deletions

View File

@@ -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:

View File

@@ -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):

View File

@@ -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()

View File

@@ -1525,6 +1525,7 @@ def test_get_services(app, mockservice_url):
'pid': mockservice.proc.pid,
'prefix': mockservice.server.base_url,
'url': mockservice.url,
'info': {},
}
}
@@ -1551,6 +1552,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,