mirror of
https://github.com/ansible-collections/community.docker.git
synced 2026-07-29 11:55:04 +00:00
fix(community.docker.docker_volume): labels can be none (#702)
* fix(community.docker.docker_volume): labels can be none
catch case where volume labels can are done (default) eg:
$ docker volume inspect foo
[
{
"CreatedAt": "2023-11-11T12:55:23+01:00",
"Driver": "local",
"Labels": null,
"Mountpoint": "/var/lib/docker/volumes/foo/_data",
"Name": "foo",
"Options": {},
"Scope": "local"
}
]
* Update plugins/modules/docker_volume.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* add(community.docker.docker_volume): changelog fragment
* Update changelogs/fragments/702-docker-volume-label-none.yaml
Co-authored-by: Felix Fontein <felix@fontein.de>
---------
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
@@ -214,7 +214,7 @@ class DockerVolumeManager(object):
|
||||
parameter=value,
|
||||
active=self.existing_volume['Options'].get(key))
|
||||
if self.parameters.labels:
|
||||
existing_labels = self.existing_volume.get('Labels', {})
|
||||
existing_labels = self.existing_volume.get('Labels') or {}
|
||||
for label in self.parameters.labels:
|
||||
if existing_labels.get(label) != self.parameters.labels.get(label):
|
||||
differences.add('labels.%s' % label,
|
||||
|
||||
Reference in New Issue
Block a user