mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
parent
1e0363ec7d
commit
c67f4290e6
2 changed files with 18 additions and 4 deletions
|
@ -0,0 +1,3 @@
|
||||||
|
---
|
||||||
|
minor_changes:
|
||||||
|
- "docker_volume - option minimal versions now checked. (https://github.com/ansible/ansible/issues/38833)"
|
|
@ -216,10 +216,15 @@ class DockerVolumeManager(object):
|
||||||
if not self.existing_volume:
|
if not self.existing_volume:
|
||||||
if not self.check_mode:
|
if not self.check_mode:
|
||||||
try:
|
try:
|
||||||
resp = self.client.create_volume(self.parameters.volume_name,
|
params = dict(
|
||||||
driver=self.parameters.driver,
|
driver=self.parameters.driver,
|
||||||
driver_opts=self.parameters.driver_options,
|
driver_opts=self.parameters.driver_options,
|
||||||
labels=self.parameters.labels)
|
)
|
||||||
|
|
||||||
|
if self.parameters.labels is not None:
|
||||||
|
params['labels'] = self.parameters.labels
|
||||||
|
|
||||||
|
resp = self.client.create_volume(self.parameters.volume_name, **params)
|
||||||
self.existing_volume = self.client.inspect_volume(resp['Name'])
|
self.existing_volume = self.client.inspect_volume(resp['Name'])
|
||||||
except APIError as e:
|
except APIError as e:
|
||||||
self.client.fail(text_type(e))
|
self.client.fail(text_type(e))
|
||||||
|
@ -275,11 +280,17 @@ def main():
|
||||||
debug=dict(type='bool', default=False)
|
debug=dict(type='bool', default=False)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
option_minimal_versions = dict(
|
||||||
|
labels=dict(docker_py_version='1.10.0', docker_api_version='1.23'),
|
||||||
|
)
|
||||||
|
|
||||||
client = AnsibleDockerClient(
|
client = AnsibleDockerClient(
|
||||||
argument_spec=argument_spec,
|
argument_spec=argument_spec,
|
||||||
supports_check_mode=True,
|
supports_check_mode=True,
|
||||||
min_docker_version='1.10.0',
|
min_docker_version='1.10.0',
|
||||||
|
min_docker_api_version='1.21',
|
||||||
# "The docker server >= 1.9.0"
|
# "The docker server >= 1.9.0"
|
||||||
|
option_minimal_versions=option_minimal_versions,
|
||||||
)
|
)
|
||||||
|
|
||||||
cm = DockerVolumeManager(client)
|
cm = DockerVolumeManager(client)
|
||||||
|
|
Loading…
Reference in a new issue