Fix error when there are no docker volumes present yet #28145
Merged
Conversation
The test
|
@chouseknecht @alikins Any word on this? Would love to get this fix in (or someone else's fix for the same error) so I can go back to using Ansible's master branch. |
@chouseknecht it's too bad this didn't make it into 2.4.0.0, but it should be merged ASAP. I could not imagine that the Docker API would give a None instead of an empty list when there are no volumes. |
rebuild_merge |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
SUMMARY
The existing code will attempt to iterate over
None
. A quickif
statement protects thefor
loop and returnsNone
. Return ofNone
because there are no volumes.ISSUE TYPE
COMPONENT NAME
In the cloud module, in the docker module, the
docker_volume
commandANSIBLE VERSION
ADDITIONAL INFORMATION
Attempt to create a volume, where there isn't one on the server yet. Manually do
docker volume ls -q | xargs docker volume rm
if neededBefore:
After: