diff --git a/VERSION b/VERSION index 324cf0a..027870b 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2019.08.26 +2019.08.28 diff --git a/container_shell/lib/dockage.py b/container_shell/lib/dockage.py index 301f21b..e13db0a 100644 --- a/container_shell/lib/dockage.py +++ b/container_shell/lib/dockage.py @@ -86,10 +86,11 @@ def mounts(mount_dict): """ the_mounts = [] for local_dir, container_dir in mount_dict.items(): - a_mount = docker.types.Mount(source=local_dir, - target=container_dir, - type='bind') - the_mounts.append(a_mount) + for mount_point in container_dir.split(','): + a_mount = docker.types.Mount(source=local_dir, + target=mount_point, + type='bind') + the_mounts.append(a_mount) return the_mounts #pylint: disable=R0913 diff --git a/sample.config.ini b/sample.config.ini index d763805..752e911 100644 --- a/sample.config.ini +++ b/sample.config.ini @@ -43,6 +43,9 @@ servers = 8.8.8.8,8.8.8.9 # containered environment. Omit this whole section to perform no host mounts. [mounts] /home=/home +# If you want the same host location mounted to multiple paths *inside* the +# container, seperaste those paths wtih a command like this +/some/host/path=/mnt/foo,/mnt/bar # Limit the resources a container can use. # Omit lines to put zero limits on that specific resource. diff --git a/tests/test_dockage.py b/tests/test_dockage.py index e3ce66e..ec42c8f 100644 --- a/tests/test_dockage.py +++ b/tests/test_dockage.py @@ -68,6 +68,15 @@ def test_objects(self): self.assertEqual(mount_obj, expected) + def test_multiple_mounts(self): + """``dockage`` 'mounts' parses a common, and mounts that path to multiple locations""" + mount_dict = {'/home': '/home/bob,/home/jill'} + + mount_objs = dockage.mounts(mount_dict) + expected = [docker.types.Mount(source='/home', target='/home/bob', type='bind'), + docker.types.Mount(source='/home', target='/home/jill', type='bind')] + + self.assertEqual(mount_objs, expected) class TestContainerCommand(unittest.TestCase): """A suite of test cases for the ``container_command`` function"""