mirror of https://github.com/docker/docker-py.git
feat(volumes): add missing labels attribute
Signed-off-by: Filip "Ret2Me" Poplewski <37419029+Ret2Me@users.noreply.github.com>
This commit is contained in:
parent
db7f8b8bb6
commit
30d050cc42
|
|
@ -11,6 +11,20 @@ class Volume(Model):
|
|||
"""The name of the volume."""
|
||||
return self.attrs['Name']
|
||||
|
||||
@property
|
||||
def labels(self):
|
||||
"""
|
||||
The labels of a volume as dictionary.
|
||||
"""
|
||||
try:
|
||||
result = self.attrs['Config'].get('Labels')
|
||||
return result or {}
|
||||
except KeyError as ke:
|
||||
raise DockerException(
|
||||
'Label data is not available for sparse objects. Call reload()'
|
||||
' to retrieve all information'
|
||||
) from ke
|
||||
|
||||
def remove(self, force=False):
|
||||
"""
|
||||
Remove this volume.
|
||||
|
|
|
|||
Loading…
Reference in New Issue