Skip to content
This repository was archived by the owner on Jan 16, 2018. It is now read-only.

Commit e05e600

Browse files
committed
Adding support for local-persist volume driver.
Pass the right option so that the mountpoint can be specified.
1 parent c5db6c7 commit e05e600

1 file changed

Lines changed: 13 additions & 6 deletions

File tree

cassinyspawner/swarmspawner.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ def client(self):
9191

9292
placement = List([], config=True,
9393
help=dedent(
94-
"""List of placement constraints into the swarm
94+
""""List of placement constraints into the swarm
95+
9596
"""))
9697

9798
networks = List([], config=True,
@@ -280,7 +281,7 @@ def start(self):
280281
if hasattr(self, 'container_spec') and self.container_spec is not None:
281282
container_spec = dict(**self.container_spec)
282283
elif user_options == {}:
283-
raise("A container_spec is needed in to create a service")
284+
raise ("A container_spec is needed in to create a service")
284285

285286
container_spec.update(user_options.get('container_spec', {}))
286287

@@ -295,10 +296,16 @@ def start(self):
295296
username=self.service_owner)
296297

297298
if 'driver_config' in m:
298-
device = m['driver_config']['options']['device'].format(
299-
username=self.service_owner
300-
)
301-
m['driver_config']['options']['device'] = device
299+
driver = m['driver_config']['name']
300+
if driver == 'local-persist':
301+
device = m['driver_config']['options']['mountpoint'].format(
302+
username=self.service_owner)
303+
m['driver_config']['options']['mountpoint'] = device
304+
else:
305+
device = m['driver_config']['options']['device'].format(
306+
username=self.service_owner)
307+
m['driver_config']['options']['device'] = device
308+
302309
m['driver_config'] = docker.types.DriverConfig(
303310
**m['driver_config'])
304311

0 commit comments

Comments
 (0)