mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-13 04:53:01 +00:00
comment review
This commit is contained in:
@@ -55,8 +55,11 @@ class Spawner(LoggingConfigurable):
|
||||
will_resume = Bool(False,
|
||||
help="""Whether the Spawner will resume on next start
|
||||
|
||||
If a Spawner will resume instead of starting anew (e.g. resuming a Docker container),
|
||||
API tokens in use when the Spawner stops will not be deleted.
|
||||
|
||||
Default is False where each launch of the Spawner will be a new instance.
|
||||
If True, an existing Spawner will resume instead of starting anew
|
||||
(e.g. resuming a Docker container),
|
||||
and API tokens in use when the Spawner stops will not be deleted.
|
||||
"""
|
||||
)
|
||||
|
||||
|
@@ -235,7 +235,7 @@ class User(HasTraits):
|
||||
# Handle < 0.7 behavior with a warning, assuming info was stored in db by the Spawner.
|
||||
self.log.warning("DEPRECATION: Spawner.start should return (ip, port) in JupyterHub >= 0.7")
|
||||
if spawner.api_token != api_token:
|
||||
# Spawner re-used an API token, discard the one we just created
|
||||
# Spawner re-used an API token, discard the unused api_token
|
||||
orm_token = orm.APIToken.find(self.db, api_token)
|
||||
if orm_token is not None:
|
||||
self.db.delete(orm_token)
|
||||
@@ -321,6 +321,8 @@ class User(HasTraits):
|
||||
self.db.delete(self.server)
|
||||
self.server = None
|
||||
if not spawner.will_resume:
|
||||
# find and remove the API token if the spawner isn't
|
||||
# going to re-use it next time
|
||||
orm_token = orm.APIToken.find(self.db, api_token)
|
||||
if orm_token:
|
||||
self.db.delete(orm_token)
|
||||
|
Reference in New Issue
Block a user