Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

avoid name collisions when using named servers #386

Merged
merged 3 commits into from
Aug 5, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
persist object_name across restarts
prioritize already running names over new template config
  • Loading branch information
minrk committed Jul 20, 2020
commit 05f5433ee2852cc978faf6fa2930f5e48ecd70ac
9 changes: 8 additions & 1 deletion dockerspawner/dockerspawner.py
Original file line number Diff line number Diff line change
Expand Up @@ -750,10 +750,17 @@ def load_state(self, state):
else:
self.object_id = state.get("object_id", "")

# override object_name from state if defined
# to avoid losing track of running servers
self.object_name = state.get("object_name", None) or self.object_name

def get_state(self):
state = super(DockerSpawner, self).get_state()
if self.object_id:
state["object_id"] = self.object_id
# persist object_name if running
# so that a change in the template doesn't lose track of running servers
state["object_name"] = self.object_name
return state

def _public_hub_api_url(self):
Expand Down Expand Up @@ -1220,4 +1227,4 @@ def deprecated(self, *args, **kwargs):
]:
setattr(
DockerSpawner, _old_name, _deprecated_method(_old_name, _new_name, _version),
)
)