Skip to content
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

Merged
merged 3 commits into from
Aug 28, 2018

Conversation

felixfontein
Copy link
Contributor

@felixfontein felixfontein commented Jul 5, 2018

SUMMARY

Currently, docker_container will die when creating a container in check mode or debug mode (see #33578). The problem is that a docker.types.containers.HostConfig object is added to results (as part of self.parameters.create_parameters), which Ansible's JSON sanitizing code cannot handle.

Fixes #33578.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

docker_container

ANSIBLE VERSION
2.6.0
2.5.x
2.4.x

(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)

@ansibot
Copy link
Contributor

ansibot commented Jul 5, 2018

@ansibot ansibot added affects_2.7 This issue/PR affects Ansible v2.7 bug This issue/PR relates to a bug. cloud community_review In order to be merged, this PR must follow the community review workflow. docker module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. support:community This issue/PR relates to code supported by the Ansible community. labels Jul 5, 2018
@samdoran samdoran removed the needs_triage Needs a first human triage before being processed. label Jul 5, 2018
# 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'])
Copy link
Contributor

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?

Copy link
Contributor Author

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?

@ansibot ansibot added core_review In order to be merged, this PR must follow the core review workflow. support:core This issue/PR relates to code supported by the Ansible Engineering Team. and removed community_review In order to be merged, this PR must follow the community review workflow. labels Jul 6, 2018
@kassiansun
Copy link
Contributor

shipit

@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Jul 14, 2018
Copy link
Contributor

@jamescassell jamescassell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shipit

@felixfontein felixfontein changed the title docker_container: fix check more for container creation docker_container: fix check mode for container creation Jul 25, 2018
@felixfontein
Copy link
Contributor Author

shipit

@felixfontein
Copy link
Contributor Author

bot_status

@ansibot
Copy link
Contributor

ansibot commented Aug 22, 2018

Components

lib/ansible/module_utils/docker_common.py
support: core
maintainers:

lib/ansible/modules/cloud/docker/docker_container.py
support: community
maintainers: chouseknecht cove dusdanig felixfontein joshuaconner kassiansun softzilla zfil

Metadata

waiting_on: ansible
changes_requested_by: null
needs_info: False
needs_revision: False
needs_rebase: False
merge_commits: []
too many files or commits: False
mergeable_state: clean
shippable_status: success
maintainer_shipits (module maintainers): 2
community_shipits (namespace maintainers): 0
ansible_shipits (core team members): 0
shipit_actors (maintainers or core team members): kassiansun felixfontein
shipit_actors_other: jamescassell
automerge: automerge ci_stale test failed

click here for bot help

@ansibot ansibot added shipit This PR is ready to be merged by Core and removed core_review In order to be merged, this PR must follow the core review workflow. stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. labels Aug 22, 2018
@felixfontein
Copy link
Contributor Author

@abadger Is it possible to get this (and #43238, and #42641) merged before Core Freeze? Or is it possible to still get them merged after Core Freeze and before Community Freeze?

@gundalow
Copy link
Contributor

docker_container.py is community, so this is good to merge into devel.

@gundalow gundalow merged commit fabba43 into ansible:devel Aug 28, 2018
@felixfontein felixfontein deleted the docker_container-check-mode-fix branch August 28, 2018 11:04
@felixfontein
Copy link
Contributor Author

@gundalow Thanks for merging!

felixfontein added a commit to felixfontein/ansible that referenced this pull request Aug 28, 2018
* 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.
felixfontein added a commit to felixfontein/ansible that referenced this pull request Sep 1, 2018
mattclay pushed a commit that referenced this pull request Sep 4, 2018
* 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.
abadger pushed a commit that referenced this pull request Sep 6, 2018
* Add changelog entry for #16748.

* Changelog entry for #33579.

* Added changelog for #42380.

* Added changelog for #42641.

* Adding changelog entry for #42857.

* Added changelog for #44808.
ndswartz pushed a commit to ndswartz/ansible that referenced this pull request Nov 28, 2018
* 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.
@ansible ansible locked and limited conversation to collaborators Jul 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.7 This issue/PR affects Ansible v2.7 bug This issue/PR relates to a bug. cloud docker module This issue/PR relates to a module. shipit This PR is ready to be merged by Core support:community This issue/PR relates to code supported by the Ansible community. support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

crash when using docker_container with a ulimit in check mode
6 participants