-
Notifications
You must be signed in to change notification settings - Fork 23.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docker_container: fix various idempotency problems and non-working op…
…tions (#45905) * Sorting args. * Doing comparisons of options with container parameters in a more context-sensitive way. This prevents unnecessary restarts, or missing restarts (f.ex. if parameters are removed from ``cmd``). * Make blkio_weight work. * Fix cap_drop idempotency problem. * Making groups idempotent if it contains integers. * Make cpuset_mems work. * Make dns_opts work. * Fixing log_opts: docker expects string values, returns error for integer. * Adding tests from felixfontein/ansible-docker_container-test#2. * Make uts work. * Adding changelog entry. * Forgot option security_opts. * Fixing typo. * Explain strict set(dict) comparison a bit more. * Improving idempotency tests. * Making dns_servers a list, since the ordering is relevant. * Making dns_search_domains a list, since the ordering is relevant. * Improving dns_search_domains/dns_servers. * Fixing entrypoint test. * Making sure options are only supported for correct docker-py versions.
- Loading branch information
1 parent
18b575b
commit 1d01543
Showing
7 changed files
with
3,498 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
bugfixes: | ||
- "docker_container - Makes ``blkio_weight``, ``cpuset_mems``, ``dns_opts`` and ``uts`` options actually work." | ||
- "docker_container - Fix idempotency problems with ``cap_drop`` and ``groups`` (when numeric group IDs were used)." | ||
- "docker_container - Fix type conversion errors for ``log_options``." | ||
- "docker_container - Fixing various comparison/idempotency problems related to wrong comparisons. | ||
In particular, comparisons for ``command`` and ``entrypoint`` (both lists) no longer ignore missing | ||
elements during idempotency checks." |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
TEST3=val3 | ||
TEST4=val4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,31 @@ | ||
--- | ||
- block: | ||
- name: Create random container name prefix | ||
set_fact: | ||
cname_prefix: "{{ 'ansible-test-%0x' % ((2**32) | random) }}" | ||
cnames: [] | ||
- name: Create random container name prefix | ||
set_fact: | ||
cname_prefix: "{{ 'ansible-test-%0x' % ((2**32) | random) }}" | ||
cnames: [] | ||
dnetworks: [] | ||
|
||
- debug: | ||
msg: "Using container name prefix {{ cname_prefix }}" | ||
|
||
- debug: | ||
msg: "Using container name prefix {{ cname_prefix }}" | ||
- block: | ||
- include_tasks: run-test.yml | ||
with_fileglob: | ||
- "tests/*.yml" | ||
|
||
- block: | ||
- include_tasks: run-test.yml | ||
with_fileglob: | ||
- "tests/*.yml" | ||
always: | ||
- name: "Make sure all containers are removed" | ||
docker_container: | ||
name: "{{ item }}" | ||
state: absent | ||
stop_timeout: 1 | ||
with_items: "{{ cnames }}" | ||
- name: "Make sure all networks are removed" | ||
docker_network: | ||
name: "{{ item }}" | ||
state: absent | ||
force: yes | ||
with_items: "{{ dnetworks }}" | ||
|
||
always: | ||
- name: "Make sure all containers are removed" | ||
docker_container: | ||
name: "{{ item }}" | ||
state: absent | ||
stop_timeout: 1 | ||
with_items: "{{ cnames }}" | ||
when: ansible_os_family != 'RedHat' or ansible_distribution_major_version != '6' | ||
# Skip for CentOS 6 | ||
when: ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6 |
Oops, something went wrong.