Allow setting mode on volumes

This commit is contained in:
Einar Forselv 2019-04-18 07:22:24 +02:00
parent ac7237faa8
commit 756da55018
1 changed files with 2 additions and 2 deletions

View File

@ -44,14 +44,14 @@ class Container:
return self.get_config('Env', default=[]) return self.get_config('Env', default=[])
@property @property
def volumes(self): def volumes(self, mode='rw'):
""" """
Return volumes for the container in the following format: Return volumes for the container in the following format:
{'/home/user1/': {'bind': '/mnt/vol2', 'mode': 'rw'},} {'/home/user1/': {'bind': '/mnt/vol2', 'mode': 'rw'},}
""" """
volumes = {} volumes = {}
for mount in self._mounts: for mount in self._mounts:
volumes[mount.source] = {'bind': mount.destination, 'mode': 'ro'} volumes[mount.source] = {'bind': mount.destination, 'mode': mode}
return volumes return volumes