-
Notifications
You must be signed in to change notification settings - Fork 23.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docker_container: fix check mode for container creation #42380
docker_container: fix check mode for container creation #42380
Conversation
# derived from dict, which ansible cannot convert to JSON correctly. | ||
# Therefore, we make sure we copy it to turn it into a regular dict. | ||
debug_parameters = dict(create_parameters) | ||
debug_parameters['host_config'] = dict(debug_parameters['host_config']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a helper for recursive converting anything with an underlying type of dict
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is 6c3acc8 doing what you were thinking of?
…eturn values of docker_container.
shipit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shipit
shipit |
bot_status |
Componentslib/ansible/module_utils/docker_common.py lib/ansible/modules/cloud/docker/docker_container.py Metadatawaiting_on: ansible |
|
@gundalow Thanks for merging! |
* Create copy of HostConfig object before adding it to results. * Create general sanitize function in docker_common. Using it for all return values of docker_container. * Make Python 2.6 compatible.
* docker_container: fix check mode for container creation (#42380) * Create copy of HostConfig object before adding it to results. * Create general sanitize function in docker_common. Using it for all return values of docker_container. * Make Python 2.6 compatible. * Added changelog.
* Add changelog entry for ansible#16748. * Changelog entry for ansible#33579. * Added changelog for ansible#42380. * Added changelog for ansible#42641. * Adding changelog entry for ansible#42857. * Added changelog for ansible#44808.
SUMMARY
Currently,
docker_container
will die when creating a container in check mode or debug mode (see #33578). The problem is that adocker.types.containers.HostConfig
object is added to results (as part ofself.parameters.create_parameters
), which Ansible's JSON sanitizing code cannot handle.Fixes #33578.
ISSUE TYPE
COMPONENT NAME
docker_container
ANSIBLE VERSION
(I've used both 2.6 and the
devel
branch to reproduce this, but the bug has already been reported for 2.4.2; see #33578)