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 behavior when image is not specified #46322

Merged

Conversation

felixfontein
Copy link
Contributor

SUMMARY

When image is not specified, but the container needs to be re-created for some reason (restart, configuration changed, etc.), currently simply nothing happens (without any user feedback). This is a consequence of #41678, which simply does not run the configuration check when image is not specified.

This PR replaces the change in #41678 with slightly more sophisticated code:

  1. If the container doesn't exist yet, a (useful) error is returned because image is really needed in this place.
  2. If the container already exists, the container's image ID is used for recreation.

Fixes #21188, fixes #27960.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

docker_container

ANSIBLE VERSION
2.8.0

@ansibot
Copy link
Contributor

ansibot commented Sep 30, 2018

@ansibot ansibot added affects_2.8 This issue/PR affects Ansible v2.8 bug This issue/PR relates to a bug. cloud core_review In order to be merged, this PR must follow the core 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. support:core This issue/PR relates to code supported by the Ansible Engineering Team. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. and removed core_review In order to be merged, this PR must follow the core review workflow. labels Sep 30, 2018
@felixfontein
Copy link
Contributor Author

Restarting tests.

@felixfontein felixfontein reopened this Sep 30, 2018
@ansibot ansibot added core_review In order to be merged, this PR must follow the core review workflow. and removed needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Sep 30, 2018
@bcoca bcoca removed needs_triage Needs a first human triage before being processed. labels Oct 1, 2018
@kassiansun
Copy link
Contributor

shipit

@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. labels Oct 5, 2018
@gundalow gundalow merged commit 895019c into ansible:devel Oct 6, 2018
@felixfontein felixfontein deleted the docker_container-fix-missing-image branch October 6, 2018 15:38
@felixfontein
Copy link
Contributor Author

@kassiansun @evrardjp Thanks for reviewing!
@gundalow Thanks for merging!

felixfontein added a commit to felixfontein/ansible that referenced this pull request Oct 6, 2018
…6322)

* Don't simply ignore container in present() if image is not specified.

* Use image from existing container for recreation if not specified.

* Added changelog.

* Improve comment.

(cherry picked from commit 895019c)
felixfontein added a commit to felixfontein/ansible that referenced this pull request Oct 6, 2018
…6322)

* Don't simply ignore container in present() if image is not specified.

* Use image from existing container for recreation if not specified.

* Added changelog.

* Improve comment.

(cherry picked from commit 895019c)
abadger pushed a commit that referenced this pull request Oct 9, 2018
* Don't simply ignore container in present() if image is not specified.

* Use image from existing container for recreation if not specified.

* Added changelog.

* Improve comment.

(cherry picked from commit 895019c)
mattclay pushed a commit that referenced this pull request Oct 16, 2018
* Don't simply ignore container in present() if image is not specified.

* Use image from existing container for recreation if not specified.

* Added changelog.

* Improve comment.

(cherry picked from commit 895019c)
@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.8 This issue/PR affects Ansible v2.8 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
6 participants