API: pass 'server_state' through to admin clients only

- This will allow, for example, cull_idle_servers to be more
  intelligent when culling servers.
- This is only given to admin API users, because we don't know if all
  spawners expect their state to be made available to users.
This commit is contained in:
Richard Darst
2018-04-18 16:00:49 +03:00
parent bd816310cb
commit 2344d696ca
5 changed files with 14 additions and 5 deletions

View File

@@ -207,6 +207,9 @@ def normalize_user(user):
for key in ('started', 'last_activity'):
server[key] = normalize_timestamp(server[key])
server['progress_url'] = re.sub(r'.*/hub/api', 'PREFIX/hub/api', server['progress_url'])
if (isinstance(server['state'], dict)
and isinstance(server['state'].get('pid', None), int)):
server['state']['pid'] = 0
return user
def fill_user(model):