feat(volumes): add missing labels attribute

Signed-off-by: Filip "Ret2Me" Poplewski <37419029+Ret2Me@users.noreply.github.com>
This commit is contained in:
Filip "Ret2Me" Poplewski 2025-04-18 16:56:16 +02:00 committed by GitHub
parent db7f8b8bb6
commit 30d050cc42
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 14 additions and 0 deletions

View File

@ -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.