Skip to content

Commit

Permalink
Backport of ansible-collections/community.docker#43 (518e99411a9ce47c…
Browse files Browse the repository at this point in the history
…249a045b346cf28b63b512e2).
  • Loading branch information
felixfontein committed Dec 9, 2020
1 parent fb3085e commit f3b1038
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -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)."
13 changes: 6 additions & 7 deletions plugins/modules/cloud/docker/docker_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -1451,13 +1451,12 @@ def __init__(self, client):
# 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'])
Expand Down

0 comments on commit f3b1038

Please sign in to comment.