Support volume_driver in compose

* Add support for volume_driver parameter in compose yml
* Don't expand volume host paths if a volume_driver is specified
  (i.e., disable compose feature "relative to absolute path
  transformation" when volume drivers are in use, since volume drivers
  can use name where host path is normally specified; this is a
  heuristic)

Signed-off-by: Luke Marsden <luke@clusterhq.com>
This commit is contained in:
Luke Marsden 2015-06-03 12:21:29 +01:00 committed by Aanand Prasad
commit a68ee0d9c2
4 changed files with 33 additions and 2 deletions

View file

@ -72,6 +72,22 @@ class VolumePathTest(unittest.TestCase):
d = make_service_dict('foo', {'volumes': ['~:/container/path']}, working_dir='.')
self.assertEqual(d['volumes'], ['/home/user:/container/path'])
def test_named_volume_with_driver(self):
d = make_service_dict('foo', {
'volumes': ['namedvolume:/data'],
'volume_driver': 'foodriver',
}, working_dir='.')
self.assertEqual(d['volumes'], ['namedvolume:/data'])
@mock.patch.dict(os.environ)
def test_named_volume_with_special_chars(self):
os.environ['NAME'] = 'surprise!'
d = make_service_dict('foo', {
'volumes': ['~/${NAME}:/data'],
'volume_driver': 'foodriver',
}, working_dir='.')
self.assertEqual(d['volumes'], ['~/${NAME}:/data'])
class MergePathMappingTest(object):
def config_name(self):