1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Backport of https://github.com/ansible-collections/community.docker/pull/43 (518e99411a9ce47c249a045b346cf28b63b512e2). (#1468)

This commit is contained in:
Felix Fontein 2020-12-09 09:05:30 +01:00 committed by GitHub
parent d2b1df49c1
commit a118bb8d05
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 7 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- "docker_container - the validation for ``capabilities`` in ``device_requests`` was incorrect (https://github.com/ansible-collections/community.docker/issues/42, https://github.com/ansible-collections/community.docker/pull/43)."

View file

@ -1451,13 +1451,12 @@ class TaskParameters(DockerBaseClass):
# Make sure that capabilities are lists of lists of strings
if dr['capabilities']:
for or_index, or_list in enumerate(dr['capabilities']):
for and_index, and_list in enumerate(or_list):
for term_index, term in enumerate(and_list):
if not isinstance(term, string_types):
self.fail(
"device_requests[{0}].capabilities[{1}][{2}][{3}] is not a string".format(
dr_index, or_index, and_index, term_index))
and_list[term_index] = to_native(term)
for and_index, and_term in enumerate(or_list):
if not isinstance(and_term, string_types):
self.fail(
"device_requests[{0}].capabilities[{1}][{2}] is not a string".format(
dr_index, or_index, and_index))
or_list[and_index] = to_native(and_term)
# Make sure that options is a dictionary mapping strings to strings
if dr['options']:
dr['options'] = clean_dict_booleans_for_docker_api(dr['options'])