Files
docker-docs/compose/volume.py
Joffrey F ec5111f1c2 Volumes are now prefixed with the project name
When created through the compose file, volumes are prefixed
with the name of the project they belong to + underscore,
similarly to how containers are currently handled.

Signed-off-by: Joffrey F <joffrey@docker.com>
2016-01-05 15:21:53 -08:00

26 lines
687 B
Python

from __future__ import unicode_literals
class Volume(object):
def __init__(self, client, project, name, driver=None, driver_opts=None):
self.client = client
self.project = project
self.name = name
self.driver = driver
self.driver_opts = driver_opts
def create(self):
return self.client.create_volume(
self.full_name, self.driver, self.driver_opts
)
def remove(self):
return self.client.remove_volume(self.full_name)
def inspect(self):
return self.client.inspect_volume(self.full_name)
@property
def full_name(self):
return '{0}_{1}'.format(self.project, self.name)