Skip to content

Commit 56602aa

Browse files
committed
Added support for named-servers
1 parent ee566d5 commit 56602aa

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

systemdspawner/systemdspawner.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,13 @@ class SystemdSpawner(Spawner):
137137
"""
138138
).tag(config=True)
139139

140+
append_name = Bool(
141+
True,
142+
help="""
143+
Append -{self.name} to the unit if using c.JupyterHub.allow_named_servers
144+
"""
145+
).tag(config=True)
146+
140147
slice = Unicode(
141148
None,
142149
allow_none=True,
@@ -151,6 +158,8 @@ def __init__(self, *args, **kwargs):
151158
super().__init__(*args, **kwargs)
152159
# All traitlets configurables are configured by now
153160
self.unit_name = self._expand_user_vars(self.unit_name_template)
161+
if self.append_name and self.name:
162+
self.unit_name = self.unit_name + '-' + self.name
154163

155164
self.log.debug('user:%s Initialized spawner with unit %s', self.user.name, self.unit_name)
156165

0 commit comments

Comments
 (0)