mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-26 20:31:27 -07:00
Docker volume fix labels (#48536)
* Add integration test for labels (which fails). * Changing labels from list to dict. * Add changelog.
This commit is contained in:
parent
9a848ca883
commit
feb60b947c
3 changed files with 56 additions and 4 deletions
|
@ -25,6 +25,7 @@ options:
|
|||
description:
|
||||
- Name of the volume to operate on.
|
||||
required: true
|
||||
type: dict
|
||||
aliases:
|
||||
- volume_name
|
||||
|
||||
|
@ -32,15 +33,18 @@ options:
|
|||
description:
|
||||
- Specify the type of volume. Docker provides the C(local) driver, but 3rd party drivers can also be used.
|
||||
default: local
|
||||
type: str
|
||||
|
||||
driver_options:
|
||||
description:
|
||||
- "Dictionary of volume settings. Consult docker docs for valid options and values:
|
||||
U(https://docs.docker.com/engine/reference/commandline/volume_create/#driver-specific-options)"
|
||||
type: dict
|
||||
|
||||
labels:
|
||||
description:
|
||||
- List of labels to set for the volume
|
||||
- Dictionary of label key/values to set for the volume
|
||||
type: dict
|
||||
|
||||
force:
|
||||
description:
|
||||
|
@ -185,8 +189,7 @@ class DockerVolumeManager(object):
|
|||
differences.append('driver_options.%s' % key)
|
||||
if self.parameters.labels:
|
||||
existing_labels = self.existing_volume.get('Labels', {})
|
||||
all_labels = set(self.parameters.labels) | set(existing_labels)
|
||||
for label in all_labels:
|
||||
for label in self.parameters.labels:
|
||||
if existing_labels.get(label) != self.parameters.labels.get(label):
|
||||
differences.append('labels.%s' % label)
|
||||
|
||||
|
@ -247,7 +250,7 @@ def main():
|
|||
state=dict(type='str', default='present', choices=['present', 'absent']),
|
||||
driver=dict(type='str', default='local'),
|
||||
driver_options=dict(type='dict', default={}),
|
||||
labels=dict(type='list'),
|
||||
labels=dict(type='dict'),
|
||||
force=dict(type='bool', default=False),
|
||||
debug=dict(type='bool', default=False)
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue