mirror of
https://github.com/ansible-collections/community.docker.git
synced 2025-12-16 20:08:41 +00:00
* 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>
(cherry picked from commit 4c220c4d74)
Co-authored-by: Alexander Jähnel <alexanderjaehnel@gmail.com>
This commit is contained in:
parent
df37b4142f
commit
35de5b3c37
2
changelogs/fragments/702-docker-volume-label-none.yaml
Normal file
2
changelogs/fragments/702-docker-volume-label-none.yaml
Normal file
@ -0,0 +1,2 @@
|
||||
bugfixes:
|
||||
- docker_volume - fix crash caused by accessing an empty dictionary. The ``has_different_config()`` was raising an ``AttributeError`` because the ``self.existing_volume["Labels"]`` dictionary was ``None`` (https://github.com/ansible-collections/community.docker/pull/702).
|
||||
@ -209,7 +209,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,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user